Johan
Johan

Reputation: 57

jQuery scrollTop() not working in IE11

I have some code that simply activates by clicking a button. When clicked, you are scrolled to that ID, that section of the site/page. It works everywhere except in IE11(the only version of IE I have). What is wrong?

jQuery(document).ready(function(){
jQuery('#seemore').click(function(){
    jQuery('body').animate({
        scrollTop: jQuery('#pgc-2040-0-1').offset().top + 40
    }, 800);
});
jQuery('#order, .order').click(function(){
    jQuery('body').animate({
        scrollTop: jQuery('#panel-2040-3-0-0').offset().top + 40
    }, 800);
}); 
}); 

Thank you!

The site is here: http://jobbcv.se It is the two red buttons at start I'm talking about.

Upvotes: 3

Views: 6390

Answers (1)

inorganik
inorganik

Reputation: 25525

Change it to include html:

$('html, body').animate({
    scrollTop: $('#pgc-2040-0-1').offset().top + 40
}, 800);

And helpful hint, you can replace jQuery with $

Upvotes: 4

Related Questions