rochal / jQuery-slimScroll

small jQuery plugin that transforms any div into a scrollable area with a nice scrollbar. Demo and more:
http://rocha.la/jQuery-slimScroll
2.23k stars 926 forks source link

Is there a way to detect slim scroll to top event? #295

Open RahmaMzoughi opened 6 years ago

RahmaMzoughi commented 6 years ago

I want to know if there is an option that let me detect if the user is scrolling to top or scrolling down ?

philipstratford commented 6 years ago

Do you mean that you want to know if the user scrolls all the way to the top or the bottom, or that you want to know if the user is scrolling up or down? They're two different things.

In any case, according to the documentation the only event built in to the plugin is the slightly generically-named slimscroll event, fired when the scrollbar reaches the top or the bottom of the parent element. Maybe you could make use of that to achieve what you need. If not, you'd have to write something yourself.

DevVIN commented 4 years ago

@RahmaMzoughi Yes there are two things in your question

  1. If you just want to know if the user is scrolling to top or scrolling down then there is a solution which I got here stackoverflow
  2. If the user is scrolled to bottom or top then you should try this $('.slim-scroll').on('slimscroll', function(e, pos){ console.log(pos); }); with some additional modifications listed here in the plugin itself depending on the jquery version you using