Thursday, 15 March 2012

javascript - variable used out of scope -


I am making a sensitive background video. I have this code.

  & lt; Video id = "bgvideo" /> Function scale video () {var windowhit = $ (window). Light (); Var windowWidth = $ (window) Width (); Var Video NativeView = $ ('Video # BGVideo') [0]. Videowidth; Var videoNativeHeight = $ ('Video # BGVideo') [0]. VideoHeight; Var heightScaleFactor = window high / video tag; Var widthScaleFactor = windowWidth / videoNativeWidth; If (widthScaleFactor & gt; = heightScaleFactor) {var scale = widthScaleFactor; } And {var scale = heightScaleFactor; } Var scaledVideoHeight = videoNativeHeight * scale; Var scaledVideoWidth = VideoNivivand * Scale; . $ ('Video # bgvideo') height (scaledVideoHeight); . $ ('Video # bgvideo') width (scaledVideoWidth); }  

I am using raucous to compile my code and etc. Zint's hanker is saying that I am using "scale" and I do not understand why.

Any suggestions?

error

Try it instead:

  function scale video () {var scale; // This change is var window het = $ (window). height (); Var windowWidth = $ (window) Width (); Var Video NativeView = $ ('Video # BGVideo') [0]. Videowidth; Var videoNativeHeight = $ ('Video # BGVideo') [0]. VideoHeight; Var heightScaleFactor = window high / video tag; Var widthScaleFactor = windowWidth / videoNativeWidth; If (widthScaleFactor & gt; = heightScaleFactor) {scale = widthScaleFactor; // just modify the value here} and {scale = heightScaleFactor; } Var scaledVideoHeight = videoNativeHeight * scale; Var scaledVideoWidth = VideoNivivand * Scale; . $ ('Video # bgvideo') height (scaledVideoHeight); . $ ('Video # bgvideo') width (scaledVideoWidth); }  

No comments:

Post a Comment