Notification texts go here Contact Us Buy Now!

How to get max scroll height in jScrollPane?

Sometimes when using the jScrollPane plugin, you might want to know when the user has reached the maximum scroll height. This can be useful for determining when to load more content or to trigger other actions.

There are a few different ways to determine when the user has reached the maximum scroll height. One solution you could try is to simulate a Bottom() and then compare the resulting PositionY() with the value before the simulation. If it hasn't changed, then the user was already at the bottom, so call Bottom() "for real" after appending the response content.

var pane = chatPane').clone();
simulatedPane.jScrollPane();
var simulatedApi = pane.data('jsp');

Then, in the success() function, use simulatedApi for the simulation.

Another approach might be to add a listener for the jsp-scroll-y event:

http://jscroll.kelvinluck.com/events.html

This listener gets passed boolean values for isAtTop and isAtBottom. You could store this in a variable and check the state of the variable before reinitialising the scroll.

Longer term, it would be great if you could add a feature request to add some additional methods to the API: isAtTop, isAtBottom, isAtLeft and isAtRight - if you add that to the github issues list then I will add it when I get a chance.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.