开发者

Scroll back to top not working in IE6

I have the following code:

// hide #back-top first
    $("#back-top").hide();

    // fade in #back-top
    $(function () {
        $(window).scroll(function () {
            if ($(this).scrollTop() > 150) {
                $('#back-top').fadeIn();
            } else {
                $('#back-top').fadeOut();
            }
        });

        // scroll body to 0px on click
        $('#back-top a').click(function () {
            $('body,html').animate({
                scrollTop: 0
            }, 900);
            return false;
        });
    });

When you click on back to top it work's fine in IE6 - but when the fadeIn and f开发者_如何学JAVAadeOut 'back to top' doesn't seem to work in IE6.


Try this

$(window).scrollTop() is the one that worked for me in all the current browsers

or

window.scroll(x, y);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜