Page 1 of 1

.on Jquery Function

Posted: Mon Nov 24, 2014 11:24 pm
by gautamz07
Checkout this Jquery pluggin :

https://github.com/luis-almeida/unveil/ ... .unveil.js

Code: Select all

$w.on("scroll.unveil resize.unveil lookup.unveil", unveil);
if i minify the above line to say this :

Code: Select all

$w.on("scroll.unveil ", unveil);
in the pluggin code , it works just fine for me , atleast for the purpose i am using it for .

noow i don't quite get the concept of adding the .unveil after adding the event type . WHY The .unveil ???

basically if i minify the line below :

Code: Select all

$w.on("scroll.unveil ", unveil);
to say :

Code: Select all

$w.on("scroll", unveil);
it still works fine . so whats the difference ???

Re: .on Jquery Function

Posted: Tue Nov 25, 2014 4:42 am
by Weirdan
Namespace events provide a common identifier. Useful when you need to remove just those events that were attached by your plugin:

Code: Select all

$(window).off(".unveil"); // removes scroll.unveil, resize.unveil and lookup.unveil at once

Re: .on Jquery Function

Posted: Tue Nov 25, 2014 6:51 am
by gautamz07
Thanks Buddy ! That was pretty helpful .