Reputation: 329
I got a single page website with a simple click/scroll navigation and I know this is stupid but i cant get this working on IE!
Chrome, Firefox it's ok, but IE is not helping me at all. If somebody could tell me what I'm i doing wrong it would be awesome :D
$(document).ready(function () {
$('.menu a').click(function () {
var link = $(this).attr('href');
if (link.match(/^#.+/)) {
var scroll = $(link).offset().top;
if (scroll < 0) { scroll = 0; }
$('body').animate({ scrollTop: scroll, easing: 'easeOut' }, 200, function () {
location.hash = link;
return false;
});
return false;
}
});
});
Upvotes: 0
Views: 1633
Reputation: 2887
See: http://jsfiddle.net/HFhCD/2/
For maximum compatibility, you must match "body" and "html".
$('body, html').animate({
scrollTop: scroll + "px"
}, 2000);
Upvotes: 1