jquery scroll to top from certain point.
I've come close with this but the solutions I've seen aren't quite nailing it.
I know how to animate a scroll to the top of a page, and I also know how to trigger that when a user has scrolled down to a certain depth, but what I'm struggling to build, is a way to allow the user scroll past that certain depth (say, 1000px) but the second they release the scroll bar, the bottom of the viewable portion animates back up to the 1000px mark.
The closest solution I've seen hijacks the user's view the instant the scroll bar crosses the 1000px threshold, and tries to animate back immediately, but because the user is still dragging, the animation is triggered again and again and so on. This is horribly jerky and confusing.
The key is the delay in waiting for the user to disengage the scroll bar before the view animates back up.
Is there any simple way in jquery to do this?
You can use window.scrollTo(0,1000) to scroll back up to the position you want.
Your challenge is really detecting when the user stops scrolling.
You could create a timer that would trigger the scrollBack() function
window.scrollTo(0,1000); //or animate
Hmmm, I'm not sure that that's working in the context I'm trying to apply this in. Alternately to a scroll option, is there a way to temporarily force the height of the html or body tag, so that the regular scroll bar conforms to the height required?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)