Answer the question
In order to leave comments, you need to log in
How to change block height as page scrolls in vuejs?
Good afternoon!
I'll start right away with the code , and so, there this mechanic is implemented in pure js, can anyone help transfer all this to vuejs?
(and yes, I realize the stupidity of this question)
Answer the question
In order to leave comments, you need to log in
data: () => ({
scroll: 0,
}),
computed: {
style() {
return {
height: здесь рассчитываете высоту на основе this.scroll,
};
},
},
created() {
const onScroll = () => this.scroll = document.scrollingElement.scrollTop;
onScroll();
document.addEventListener('scroll', onScroll);
this.$on('hook:beforeDestroy', () => document.removeEventListener('scroll', onScroll));
},
<div :style="style">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question