diff --git a/source/css/layout/page.styl b/source/css/layout/page.styl index c7c8ef1..c763a0e 100644 --- a/source/css/layout/page.styl +++ b/source/css/layout/page.styl @@ -64,6 +64,10 @@ $page-aside-width = $temp-width ? convert($temp-width):260px; box-sizing: border-box; transition(); + &.hide { + transform: translateY(-102%); + } + .header-shrink & { height: $header-shrink-height; @@ -120,7 +124,6 @@ $page-aside-width = $temp-width ? convert($temp-width):260px; width: $main-content-width-mobile; } } - } diff --git a/source/js/toc.js b/source/js/toc.js index 17d6d45..6a00d8d 100644 --- a/source/js/toc.js +++ b/source/js/toc.js @@ -33,7 +33,7 @@ function initTOC() { scrollTop: offset - 10, complete: function () { setTimeout(() => { - KEEP.utils.pageTop_dom.style.transform = 'translateY(-100%)'; + KEEP.utils.pageTop_dom.classList.add('hide'); }, 100) } }); diff --git a/source/js/utils.js b/source/js/utils.js index 848519d..4205f5c 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -38,9 +38,9 @@ KEEP.initUtils = () => { // hide header handle if (scrollTop > this.prevScrollValue && scrollTop > this.innerHeight) { - this.pageTop_dom.style.transform = 'translateY(-100%)'; + this.pageTop_dom.classList.add('hide'); } else { - this.pageTop_dom.style.transform = 'translateY(0)'; + this.pageTop_dom.classList.remove('hide'); } this.prevScrollValue = scrollTop; },