Search code examples
jqueryinternet-explorerscrolleasing

Easing not working on IE


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;
        }
    });

});

Solution

  • See: http://jsfiddle.net/HFhCD/2/

    For maximum compatibility, you must match "body" and "html".

        $('body, html').animate({
            scrollTop: scroll + "px"
        }, 2000);