H, I have a simple back to top link script working in Firefox which no longer works in Chrome or Safari wondering if anyone notices anything here? For simplicity purposes I just extracted the relevant code as to not have you rummaging through a bunch of stuff looking. Thanks!
JavaScript:
jQuery(window).load(function () {
initTopLink('#back-to-top', 400, 300);
});
// back to top scrolling
function initTopLink(element, min, fadeSpeed) {
var el = $(element);
if ($(window).height() >= min) {
// Scroll Top Link
$(element).click(function (e) {
e.preventDefault();
$.scrollTo(0, 300);
return false;
});
//listen for scroll
el.hide(); //in case the user forgot
$(window).scroll(function () {
if ($(window).scrollTop() == "0") {
el.fadeOut(fadeSpeed);
} else {
el.fadeIn(fadeSpeed);
}
});
}
}
HTML:
<div id="back-to-top" ><a href="#top"><span>Back to top</span></a></div>
CSS:
/* Back to Top */
#back-to-top span { display: none; }
#back-to-top {
border: none;
bottom: 0;
cursor: pointer;
display: none;
margin-bottom: 30px;
position: fixed;
right: 30px;
z-index: 50000;
height: 0;
width: 0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-bottom: 32px solid #e02d42;
-moz-transform: scale(.9999);
}
#back-to-top a:hover {
border: none;
}