JS for smooth scroll to the bottom of the page

user3597784

I have a JS to make a smooth scroll from the bottom of the page to the top with this and it works:

<script>

     $("a[href='#top']").click(function() {
     $("html, body").animate({ scrollTop: 0 }, "slow");
     return true;
  });
</script>

But now I want to make a smooth scroll from the top to the bottom, I tried it with this:

 <script>

     $("a[href='#footer']").click(function() {
     $("html, body").animate({ scrollToBottom: 0 }, "slow");
     return true;
  });
</script>`

It doesn't work, it's not a smooth scroll. Does anyone know what's wrong with this?

dfsq

There is no such thing as scrollToBottom. Try this:

$("html, body").animate({ scrollTop: document.body.scrollHeight }, "slow");

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

JS for smooth scroll to the bottom of the page

From Dev

JS Smooth scrolling, scroll to bottom of final / bottom div instead of top

From Java

Scroll Automatically to the Bottom of the Page

From Dev

Infinitely scroll to the bottom of the page

From Dev

Scroll to near the bottom of page

From Dev

scroll the a growing page to the bottom

From Dev

Scroll bar in page bottom

From Dev

Scroll to near the bottom of page

From Dev

Smooth scroll for one page site

From Dev

Horizontal Smooth Scroll One Page

From Dev

Smooth UITextView auto scroll to bottom of frame

From Dev

Smooth UITextView auto scroll to bottom of frame

From Dev

Offset smooth scroll bootstrap JS

From Dev

smooth-scroll js not scrolling

From Dev

Automatically scroll to bottom as the page loads

From Dev

$mdtoast position bottom of page on scroll

From Dev

$mdtoast position bottom of page on scroll

From Dev

Scroll to the Bottom of the Page after postBack

From Dev

scroll to bottom on page load but will allow to scroll on top

From Dev

scroll to bottom on page load but will allow to scroll on top

From Dev

Smooth scroll to anchor after loading new page

From Dev

Smooth Scroll to anchor edit page top

From Dev

Laravel - redirect to page and scroll to the bottom of the page

From Dev

Laravel - redirect to page and scroll to the bottom of the page

From Dev

how to scroll the page to bottom whenever the page load?

From Dev

jQuery - Smooth scroll only working to top - need it to work to bottom aswell

From Dev

jQuery - Smooth scroll only working to top - need it to work to bottom aswell

From Dev

Issue with Tabs and JS Smooth Scroll (Two Clicks)

From Dev

jquery one page scroll start at the bottom

Related Related

HotTag

Archive