I have a function that I bound with scroll() event, but the fact is I want the function to be triggered only in case of vertical scroll ( I have some horizontal
scroll()
This should work:
var prevLeft = 0; $(document).scroll( function(evt) { var currentLeft = $(this).scrollLeft(); if(prevLeft === currentLeft) { console.log("I scrolled vertically."); } else { prevLeft = currentLeft; } });