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

fix backToTop button

parent 5d3ae60a
...@@ -229,6 +229,10 @@ ...@@ -229,6 +229,10 @@
} }
} }
.nav-dropdown-list {
width: auto;
}
@media (max-width: 850px) { @media (max-width: 850px) {
.header { .header {
.nav-logo { .nav-logo {
...@@ -265,9 +269,7 @@ ...@@ -265,9 +269,7 @@
} }
</style> </style>
<template> <template>
<div <div class="headerWrapper">
class="headerWrapper"
:class="{ 'is-hidden': !visible && !isComponentPage }">
<header class="header" <header class="header"
ref="header" ref="header"
:style="headerStyle" :style="headerStyle"
...@@ -456,7 +458,7 @@ ...@@ -456,7 +458,7 @@
mounted() { mounted() {
function scroll(fn) { function scroll(fn) {
window.addEventListener('scroll', fn, false); document.body.addEventListener('scroll', fn, false);
} }
scroll(() => { scroll(() => {
if (this.isHome) { if (this.isHome) {
......
...@@ -187,11 +187,10 @@ ...@@ -187,11 +187,10 @@
toTop() { toTop() {
this.hover = false; this.hover = false;
this.showBackToTop = false; this.showBackToTop = false;
document.body.scrollTop = 0; this.componentScrollBox.scrollTop = 0;
document.documentElement.scrollTop = 0;
}, },
handleScroll() { handleScroll() {
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop; const scrollTop = this.componentScrollBox.scrollTop;
this.showBackToTop = scrollTop >= 0.5 * document.body.clientHeight; this.showBackToTop = scrollTop >= 0.5 * document.body.clientHeight;
if (this.showHeader !== this.scrollTop > scrollTop) { if (this.showHeader !== this.scrollTop > scrollTop) {
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