Why does my “Back to Top” button fail on Firefox?
Script:
$(document).ready(function () {
$(window).scroll(function () {
if ($(this).scrollTop() > 320) {
$('.scroll-box').fadeIn();
} else {
$('.scroll-box').fadeOut();
}
});
$('.scroll-box').click(function () {
$("html, body").animate({
scrollTop: 0
}, 400);
return false;
});
});
.scroll-box {display: none; position: fixed; bottom: 2px; right: 20px; width: 32px; height: 32px;}
.scroll-box:after {content: 'TOP';}