Posted By

lapinblancuk on 01/12/16


Tagged

scroll mousewheel


Versions (?)

MouseWheel scroll in JS with JQuery


 / Published in: JavaScript
 

Works on every modern Browser, including Firefox. Requires JQuery.

  1. $(document).unbind('mousewheel DOMMouseScroll').on('mousewheel DOMMouseScroll', function(event) {
  2. var delta = event.originalEvent.detail < 0 || event.originalEvent.wheelDelta > 0 ? 1 : -1;
  3.  
  4. if (delta < 0) {
  5. // scroll down
  6. } else {
  7. // scroll up
  8. }
  9. return false;
  10. });

Report this snippet  

You need to login to post a comment.