feat: 页面百分比
This commit is contained in:
parent
c6605dd309
commit
68c23b0911
|
@ -199,7 +199,7 @@ function percent() {
|
|||
var e = document.documentElement.scrollTop || window.pageYOffset,
|
||||
t = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight) - document.documentElement.clientHeight,
|
||||
o = Math.round(e / t * 100), n = document.querySelector("#percent"),
|
||||
r = window.scrollY + document.documentElement.clientHeight,
|
||||
r = window.scrollY + document.documentElement.clientHeight,
|
||||
a = document.getElementById("post-tools") || document.getElementById("footer");
|
||||
a.offsetTop + a.offsetHeight / 2 < r || 90 < o ? (document.querySelector("#nav-totop").classList.add("long"), n.innerHTML = "返回顶部") : (document.querySelector("#nav-totop").classList.remove("long"), n.innerHTML = o)
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ document.addEventListener("pjax:send", function () {
|
|||
heo.showLoading()
|
||||
});
|
||||
|
||||
document.addEventListener("pjax:complete", function () {
|
||||
document.addEventListener("load", function () {
|
||||
heo.categoriesBarActive();
|
||||
heo.tagPageActive();
|
||||
heo.onlyHome();
|
||||
|
@ -279,10 +279,10 @@ document.addEventListener("pjax:complete", function () {
|
|||
heo.darkModeStatus();
|
||||
heo.initThemeColor();
|
||||
percent();
|
||||
window.onscroll = percent;
|
||||
heo.hideLoading();
|
||||
});
|
||||
heo.initThemeColor();
|
||||
percent();
|
||||
window.onscroll = percent();
|
||||
window.onscroll = function () {
|
||||
percent();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue