Results 1 to 3 of 3

Thread: jquery scroll to top from certain point.

  1. #1
    Join Date
    Feb 2009

    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?

  2. #2
    Join Date
    Nov 2006
    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

    var backtimer;


    function scrollBack(){
    window.scrollTo(0,1000); //or animate

  3. #3
    Join Date
    Feb 2009
    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?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center