Check sticky on menu close
parent
beccd06fb8
commit
a2aface1a4
|
@ -67,6 +67,9 @@ export default {
|
||||||
this.unbindScrollListener();
|
this.unbindScrollListener();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
updated() {
|
||||||
|
this.checkSticky();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isDarkTheme() {
|
isDarkTheme() {
|
||||||
return this.$appState.darkTheme === true;
|
return this.$appState.darkTheme === true;
|
||||||
|
@ -78,14 +81,9 @@ export default {
|
||||||
this.menuActive = !this.menuActive;
|
this.menuActive = !this.menuActive;
|
||||||
},
|
},
|
||||||
bindScrollListener() {
|
bindScrollListener() {
|
||||||
if (!this.scrollListener) {
|
if (!this.scrollListener && this.container) {
|
||||||
if (this.container) {
|
|
||||||
this.scrollListener = () => {
|
this.scrollListener = () => {
|
||||||
if (window.scrollY > 0)
|
this.checkSticky();
|
||||||
this.container.classList.add('landing-header-sticky');
|
|
||||||
else
|
|
||||||
this.container.classList.remove('landing-header-sticky');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.addEventListener('scroll', this.scrollListener);
|
window.addEventListener('scroll', this.scrollListener);
|
||||||
|
@ -99,6 +97,12 @@ export default {
|
||||||
containerRef(el) {
|
containerRef(el) {
|
||||||
this.container = el;
|
this.container = el;
|
||||||
},
|
},
|
||||||
|
checkSticky() {
|
||||||
|
if (window.scrollY > 0)
|
||||||
|
this.container.classList.add('landing-header-sticky');
|
||||||
|
else
|
||||||
|
this.container.classList.remove('landing-header-sticky');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue