What I'm trying to do is unbind a specific function after it starts. In the code below, the window scrolls.
$(window).scroll(function(){
if($(window).scrollTop() == viewportheight ){
$("#landing_page").fadeOut(function() { $(window).scrollTop(0); $(window).unbind("scroll");});
}
});
Basically, when #div disappears, I want it to scroll Top (0). After scrolling from the top, I need all this function to unlock.
Is there a way to give this function a specific name and then call that name? Since this code works, only it removes all the scroll functions. (Of course I don't want to) I thought something like this:
$(window).scroll(function(FUNCTION NAME HERE){
if($(window).scrollTop() == viewportheight ){
$("#landing_page").fadeOut(function() { $(window).scrollTop(0); $(window).unbind("FUNCTION NAME HERE");});
}
});
source
share