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)?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With