+ -
当前位置:首页 → 问答吧 → 页面滚动 scrollTop :_offset.top 无效,有人晓得原因不?

页面滚动 scrollTop :_offset.top 无效,有人晓得原因不?

时间:2011-09-02

来源:互联网

function(){
              var next_top = $("#hidehotfilming");
              var _offset = next_top.offset();
              //alert(_offset.top);
              $("html,body").animate({ scrollTop :_offset.top },"slow");
       }
//alert(_offset.top)的值可以正确打出,但用在scrollTop那就无效。
但是,如果写
$("html,body").animate({ scrollTop :_offset.top },"slow");
页面就可以正常滚动,这是为什么呢?有人晓得不?

作者: 火焰楼兰   发布时间: 2011-09-02

animate的参数只能是css属性,这里的scrollTop不是css属性,是js里面的属性。

作者: yzlhyzlh   发布时间: 2011-09-04