【发布时间】:2013-10-24 21:52:26
【问题描述】:
我认为这很容易。
我有以下 HTML
<div>
<div id="child"></div>
</div>
我尝试了几件事
if ($('#child').length){
$('html, body').animate({scrollTop: $(this).parent().offset().top}, 'slow');
}
和
if ($('.success_div').length){
pdiv = $(this).parent();
$('html, body').animate({scrollTop: pdiv.offset().top}, 'slow');
}
错误:TypeError:pdiv.offset(...) 未定义
【问题讨论】:
标签: jquery jquery-animate scrolltop