0
Code:
window.onscroll = function (e) {
console.log(this.oldScroll > this.scrollY)
this.oldScroll = this.scrollY
}
How do I turn this console.log
in a Return and get the value false or true out of this Function?
note, I put this snippet inside a method that runs when the component is created, ie with the call in a created, it displays true or false on the console but nothing I tried has made me successful in using this information for another method or a var on
data: () => {}
of course, if there is a native function for this, and that is more cool, I accept the tip, the goal is to make two distinct toolbars go down or up when rolling the well
good, this I know how to do, however, as the information can go outside the scope window.onscroll = Function (and) { /get out of here/ }
– flourigh
@flourigh by which I understood the best way is for you to have a computed variable. Arrow in the life cycle the variables
oldScroll e this.scrollY
and adds the code of my reply.– Marconi
I understand, so there is no way to get the information inside the scope?
– flourigh