How can I trigger just single event/function on scroll Up/Down with js/jquery.
This code is simple and nice for direction detect.
var lastScrollTop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if (st > lastScrollTop){
// downscroll code
} else {
// upscroll code
}
lastScrollTop = st;
});
How to unbind events after first call and bind after scroll is Finished? I would like to use it with a vertical fullscreen slider with TweenMax.js
Thanks!