Commit 399161ea authored by Leopoldthecoder's avatar Leopoldthecoder Committed by Black Wayne

fix backToTop button

parent 5d3ae60a
......@@ -228,6 +228,10 @@
}
}
}
.nav-dropdown-list {
width: auto;
}
@media (max-width: 850px) {
.header {
......@@ -265,9 +269,7 @@
}
</style>
<template>
<div
class="headerWrapper"
:class="{ 'is-hidden': !visible && !isComponentPage }">
<div class="headerWrapper">
<header class="header"
ref="header"
:style="headerStyle"
......@@ -456,7 +458,7 @@
mounted() {
function scroll(fn) {
window.addEventListener('scroll', fn, false);
document.body.addEventListener('scroll', fn, false);
}
scroll(() => {
if (this.isHome) {
......
......@@ -187,11 +187,10 @@
toTop() {
this.hover = false;
this.showBackToTop = false;
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
this.componentScrollBox.scrollTop = 0;
},
handleScroll() {
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
const scrollTop = this.componentScrollBox.scrollTop;
this.showBackToTop = scrollTop >= 0.5 * document.body.clientHeight;
if (this.showHeader !== this.scrollTop > scrollTop) {
this.showHeader = this.scrollTop > scrollTop;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment