onClick使用jQuery .animate转到页面底部
我有一个表,其中最后一列包含操作按钮,打开表下的另一部分。 打开该部分时,正文页面保留在按下操作列按钮的位置。 我需要使用jQuery,优选使用.animate,将.html页面滚动到表格下面的已打开部分。
小提琴示例: http : //jsfiddle.net/Ksb2W/110/
如果有人帮我这个。 谢谢。
演示 http://jsfiddle.net/h4ZQR/ 或 http://jsfiddle.net/byRRY/
好的API: http : //api.jquery.com/scrollTop/
请注意:您可以使用: .animate({scrollTop: $("#whateverdiv").offset().top});
去页面的某些部分。
希望这可以帮助
HTML
Click me to go to bottom
码
$("#hulk").click(function() { $("html, body").animate({ scrollTop: $(document).height() }, "slow"); });
要么
$("a[href='#bottom']").click(function() { $("html, body").animate({ scrollTop: $(document).height() }, "slow"); return false; });