3

I have a page (that I control) that I would like it to have automatic smooth scrolling (at a controlled speed until the bottom of the page is reached).

Here is an example http://tim.theenchanter.com/2008/08/autoscroll-in-safari-firefox.html

Is there any way that could be done with jquery (not as a bookmarklet)?

smw
  • 45
  • 7

2 Answers2

1

This example will take 30 seconds to scroll to the bottom of the page.

<a href="#bottom">start scrolling</a>

<p> lots of content here </p>

<h2 id="bottom">bottom of page</h2>

<script>
  var oneSecond = 1000;

  $('a').on('click', function() {

      $("html, body").animate({ 
          scrollTop: $(document).height() 
      }, 30 * oneSecond);

      return false;
  });
</script>

You can also see

http://css-tricks.com/snippets/jquery/smooth-scrolling/

and

jQuery Scroll to bottom of page/iframe

for other examples.

Community
  • 1
  • 1
Rich Hildebrand
  • 1,047
  • 12
  • 13
0

lmgtfy

Sounds like you want it to be a constant speed - params aren't as explicit as that bookmarklet but you can adjust the easing type and duration to your liking.

Then it's just a matter of binding this to $(document).ready.

Community
  • 1
  • 1
bryce
  • 2,484
  • 1
  • 12
  • 17