jQuery scroll listener for user input (even if page isnt scrollable) -
is possible have jquery or javascript listener when user tries scroll, if web page not scrollable? need execute code when user tries scroll down, if web page short enough there no scrolling.
note solution doenst need work touch-screens.
update need different code execute when user tries scroll opposed down.
update: used on instead of bind , inserted direction of scrolling. added dommousescroll in order work in firefox.
just use:
$(window).on('mousewheel dommousescroll',function(e){ // catch or down scroll: e = e.originalevent; // delta == 1 = down, delta == -1 = up; var delta = e.wheeldelta > 0 || e.detail < 0 ? 1 : -1; } or bind else if prefer.
Comments
Post a Comment