1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 13:44:15 +00:00

Improve JS loading sequence

This commit is contained in:
Cotes Chung
2020-12-10 19:49:43 +08:00
parent d53769e52b
commit cdaa79cf80
4 changed files with 34 additions and 30 deletions

View File

@@ -1,18 +1,21 @@
/*
Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
*/
$(window).scroll(function() {
if ($(this).scrollTop() > 50
&& $("#sidebar-trigger").css("display") === "none") {
$("#back-to-top").fadeIn();
} else {
$("#back-to-top").fadeOut();
}
});
$(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 50 &&
$("#sidebar-trigger").css("display") === "none") {
$("#back-to-top").fadeIn();
} else {
$("#back-to-top").fadeOut();
}
});
$("#back-to-top").click(function() {
$("body,html").animate({scrollTop: 0}, 800);
$("body,html").animate({
scrollTop: 0
}, 800);
return false;
});
});
});