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);
精彩评论