Improve JS code style.

This commit is contained in:
Cotes Chung
2020-08-19 12:26:45 +08:00
parent a8f8bbaa1c
commit 9b35380849
11 changed files with 268 additions and 262 deletions

View File

@@ -3,16 +3,16 @@ 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();
&& $("#sidebar-trigger").css("display") === "none") {
$("#back-to-top").fadeIn();
} else {
$('#back-to-top').fadeOut();
$("#back-to-top").fadeOut();
}
});
$(function() {
$('#back-to-top').click(function() {
$('body,html').animate({scrollTop: 0}, 800);
$("#back-to-top").click(function() {
$("body,html").animate({scrollTop: 0}, 800);
return false;
});
});