Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. My jsFiddle is here.

like image 720
Suresh Pattu Avatar asked Jan 03 '12 07:01

Suresh Pattu


1 Answers

This works for me in IE8+:

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

Maybe your IF statement is throwing things off?

like image 165
Jani Anderson Avatar answered Oct 16 '22 14:10

Jani Anderson