You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.
Hi! I usually comment my code a lot so I can understand what I was trying to do when I look at it weeks later. This is the first time I write a jQuery plugin and I'm still kind of new to Javascript, so I had to do a little research of "global namespace pollution" and (if I understood) you're right, these variables don't need to be global.
Now, what I don't completely get is why are they global variables when I declare them inside a function? Is it because I'm not using var to declare them?
If you're in the global scope then there's no difference.
If you're in a function then "var" will create a local variable, "no var" will look up the scope chain until it finds the variable or hits the global scope (at which point it will create it)
Yup, that darn var that I forgot to use. Thank you, I'll push the changes in a minute :-)
The following variables are undefined and will be created on the global
window
object:winWidth
winHeight
winBottom
winRight
elHeight
elWidth
elTop
elLeft
scrollLeft
You are declaring
scrollTop
correctly, atleast for now. However, the fact that it has a trailing comment that specifically mentions "probably not needed" does not bode well.The text was updated successfully, but these errors were encountered: