-1

Is there an event handler in jQuery that watches for scrolling left and right?

I wanted to do something like

$('document').ScrolledLeft(function() {
    console.log('user scrolled left!');
})

$('document').ScrolledRight(function() {
    console.log('user scrolled right!');
})

Any suggestions?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Pennf0lio
  • 3,888
  • 8
  • 46
  • 70
  • Look for jQuery scroll event and `$(document).scrollLeft();` – Aamir Afridi May 12 '14 at 14:48
  • The other question was just catching horizontal event and was not specifying wether it's a left or right scroll event. I modified it to catch left and right scroll. http://jsbin.com/duxirada/1 – Pennf0lio May 12 '14 at 15:05

1 Answers1

0

From another question

Is there a vertical scroll event in jQuery

var prevLeft = 0;
$(document).scroll( function(evt) {
    var currentLeft = $(this).scrollLeft();
    if(prevLeft != currentLeft) {
        prevLeft = currentLeft;
        console.log("I scrolled vertically.");
    }
});
Community
  • 1
  • 1
Dany
  • 735
  • 1
  • 8
  • 27