jQuery animate scrollTop not working in IE 7

后端 未结 4 724
北荒
北荒 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:18

    Set:

    # FF、IE8        
    document.documentElement.scrollTop = 100;
    
    # chrome
    document.body.scrollTop = 100;
    

    Get:

    scrollTop = document.documentElement.scrollTop + document.body.scrollTop;
    

提交回复
热议问题