简体   繁体   English

jquery animate scrollTop函数无法在Internet Explorer中运行

[英]jquery animate scrollTop function is not working in internet explore

I am using this code: 我正在使用此代码:

$('#goto_introduction_divcontent').click(function(){    
    var targetOffset = $('#introduction_div').offset().top;    
    $('html, body').animate({scrollTop:targetOffset}, 'slow');    
    if ($.browser.msie){    
        document.documentElement.scrollTop = targetOffset;  
    }  
});   

But this not working in Internet Explorer. 但这不适用于Internet Explorer。 My jsFiddle is here . 我的jsFiddle就在这里

This works for me in IE8+: 这在IE8 +中适用于我:

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

Maybe your IF statement is throwing things off? 也许你的IF声明正在抛弃它?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM