I have written a very simple JQuery widget to handle fixed toolbars:
(function($){
$.fn.stickytoolbar = function(options){
$(window).bind(
'scroll resize', function(){
});
}
})(JQuery);
Now the problem I have is that everytime I say $('.something').stickytoolbar() it will potentially bind the window event again and again because $(window) is in the global scope.
Is there anyway there to make sure that the bind on the window only occurs once no matter how many of the stickytoolbar widgets I make?
Thanks,
Check out the one() method.