修复两栏布局不能固定 #profile 的问题 (#320)

This commit is contained in:
ZNEIAT 2018-04-30 23:06:32 +08:00 committed by Ruipeng Zhang
parent 29235f6d3a
commit a4ef07b8c4
1 changed files with 55 additions and 48 deletions

View File

@ -43,23 +43,21 @@
e.stopPropagation();
});
// To Top & Fixed Profile
// To Top
var sidebarElem = $('#sidebar'),
toTopElem = $('#toTop');
if (sidebarElem.length) {
checkDisplayToTop();
checkFixedProfile();
(function () {
if (!sidebarElem.length) return;
checkDisplayToTop();
$(document).on('scroll', function () {
checkDisplayToTop();
checkFixedProfile();
});
toTopElem.click(function () {
$('body, html').animate({ scrollTop: 0 }, 600);
});
}
var isToTopDisplayed = false;
function checkDisplayToTop() {
@ -83,6 +81,14 @@
toTopElem.css('right', 20);
}
}
})();
// Fixed Profile
(function () {
checkFixedProfile();
$(document).on('scroll', function () {
checkFixedProfile();
});
var isFixedProfile = false;
function checkFixedProfile() {
@ -115,5 +121,6 @@
isFixedProfile = false;
}
}
})();
})(jQuery);