jQuery animate scrollTop not working in IE 7

后端 未结 4 750
北荒
北荒 2020-12-16 19:34

The following works in Chrome / FF etc...

$(\'body\').animate({scrollTop : 0}, 0);

However, in IE 7, it doesn\'t do anything.
Is ther

4条回答
  •  一个人的身影
    2020-12-16 20:30

    in IE8, i use $(document).scrollTop() to get the scrollTop property, $('body').scrollTop() or $('html').scrollTop() will always return 0.

    Maybe you can use

    $(document).animate({scrollTop: 0}, 0);
    $('html,body').animate({scrollTop: 0}, 0);
    

    to make it works on all browser.

提交回复
热议问题