You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
525 B
23 lines
525 B
var SCROLL_SPEED = 400;
|
|
|
|
var ready = function(callback) {
|
|
if (document.readyState != "loading") callback();
|
|
else document.addEventListener("DOMContentLoaded", callback);
|
|
}
|
|
|
|
ready(function() {
|
|
jQuery(window).scroll(function() {
|
|
if (jQuery(this).scrollTop() > 50) {
|
|
jQuery('#back-to-top').fadeIn();
|
|
} else {
|
|
jQuery('#back-to-top').fadeOut();
|
|
}
|
|
});
|
|
jQuery('#back-to-top').click(function() {
|
|
jQuery('body,html').animate({
|
|
scrollTop: 0
|
|
}, SCROLL_SPEED);
|
|
return false;
|
|
});
|
|
});
|