inuyaksa / jquery.nicescroll

nicescroll plugin for jquery - scrollbars like iphone/ipad
https://nicescroll.areaaperta.com/
3.6k stars 1.67k forks source link

How to detect scroll has started? #542

Closed ibrahimmumcu closed 8 years ago

ibrahimmumcu commented 9 years ago

Is there any method that I can detect scroll started and stopped?

kajmagnus commented 8 years ago

Yes, niceScroll.scrollstart(function(event) { ... })) but it doesn't work for me. Only .scrollend(...) works. Is this a bug?

Here you'll find .scrollstart(...), and scrollend(callback) just below: https://github.com/inuyaksa/jquery.nicescroll/blob/af737e0f2f6d0f22c66f65809b0c93e396216e51/jquery.nicescroll.js#L2542

kajmagnus commented 8 years ago

You can use jQuery instead. This works for me, at least right now when testing in Chrome:

    // first:
    // var $viewport = $(...);
    // $viewport.niceScroll(scrollableElem, { ... });

    $viewport.on('scroll', function(){
      console.log('$ scroll');
    });
inuyaksa commented 8 years ago

Please test with this page. http://areaaperta.com/nicescroll/test/scroll.html

ibrahimmumcu commented 8 years ago

niceScroll.scrollstart works for me, thank you!