OnClick go to the bottom of the page using jQuery.animate

I have a table in which the last column contains action buttons that open another section below the table. When this section opens, the body page remains where the button from the action column is clicked. I need to use jQuery, preferably with .animate, which scrolls the .html page to this open section below the table.

Sample script: http://jsfiddle.net/Ksb2W/110/

If anyone helps me with this. Thanks.

+7
source share
1 answer

demo http://jsfiddle.net/h4ZQR/ or http://jsfiddle.net/byRRY/

Good API: http://api.jquery.com/scrollTop/

Please note: you can use: .animate({scrollTop: $("#whateverdiv").offset().top}); to go to specific sections of the page.

Hope this helps

HTML

 <a href="#bottom" id="hulk">Click me to go to bottom</a> 

the code

 $("#hulk").click(function() { $("html, body").animate({ scrollTop: $(document).height() }, "slow"); });​ 

OR

 $("a[href='#bottom']").click(function() { $("html, body").animate({ scrollTop: $(document).height() }, "slow"); return false; });​ 
+14
source

All Articles