我有这段代码,我想通常向下滚动到#results
的页面底部
<script type="text/javascript">
$(function(){
$('button[type=submit]').click(function(e){
e.preventDefault();
$.ajax({
type: "POST",
url: "postpicks.php",
data: $("#myform").serialize(),
beforeSend: function(){
$('#result').html('<div class="success"><img src="../images/loading-blue.gif" width="25" /></div>');
},
success: function(data){
$('#result').html(data);
$('html, body').animate({scrollTop:$(document).height()}, 'slow'); <---
}
});
});
});
我喜欢滚动到#result的底部。
答案 0 :(得分:0)
尝试使用:
$('html, body').animate({scrollTop:$('#result').offset().top}, 'slow');