One solution you could try is to simulate a scrollToBottom() and then compare the resulting getContentPositionY() with the value before the simulation. If it hasn't changed, then the user was already at the bottom, so call scrollToBottom() for real" after appending the response content.
One solution you could try is to simulate a scrollToBottom() and then compare the resulting getContentPositionY() with the value before the simulation. If it hasn't changed, then the user was already at the bottom, so call scrollToBottom() "for real" after appending the response content. To run the simulation, you might try cloning the original object and then modifying it in memory.
See api.jquery.com/clone/ for more info. For example: var simulatedPane = $('#chatPane').clone(); simulatedPane.jScrollPane(); var simulatedApi = simulatedPane. Data('jsp'); Then, in the success() function, use simulatedApi for the simulation.
Interesting idea. How would I simulate a scrollToBottom() though, any ideas? – Alex Ford Dec 3 '10 at 19:35 I can think of two ways: the first is to create an in-memory Javascript copy that has the same properties as the real object on the page, and run the commands on it.
The second way is to store the current scroll position, run the commands against the live object, and then restore the previous scroll position. This may cause the UI to jump, so you'd have to test it out to see if it's usable. – ChessWhiz Dec 3 '10 at 19:39 The second one I can do, but I agree that it would likely cause a UI jump.
Could you update your answer with a code sample for creating the in-memory object? – Alex Ford Dec 3 '10 at 19:42 See my edit. I haven't used jScrollPane before, but I'd expect that you would clone the #chatPane element and build from there.
– ChessWhiz Dec 3 '10 at 19:48 Hmmm, I tried cloning it but I must be doing it wrong. There are no visible jumps when I tried it the second way. If you could actually provide a sample of how to clone then I could probably do it.
Just never used .clone() before. – Alex Ford Dec 3 '10 at 19:54.
I see you already have a solution. Another approach might be to add a listener for the jsp-scroll-y event: jscrollpane.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 scrollpane.
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.
This makes much more sense and is not so "hacky". I will add a listener for this event. Also, I will add the issue to github like you asked as these properties would be great additions to the plugin.
– Alex Ford Dec 3 '10 at 22:51 Looks like I jumped the gun on this one. This sounds perfect but it is not. It is very buggy.
Every time you append the container that event fires. I've tried all sorts of things but the isAtBottom property doesn't seem to be very reliable. Looks like I'm gonna have to stick with the hack.It was far less code anyway.
Thanks though! – Alex Ford Dec 3 '10 at 23:22 Sorry - it looks like the parameters were the wrong order in the documentation! IsAtBottom is the forth parameter.
Please see this working example - when you scroll to the bottom it sticks to the bottom: jsfiddle. Net/vitch/NDFy6 – vitch Dec 6 '10 at 15:45.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.