Closed jamesgillispie closed 5 years ago
Hi @jamesgillispie
You must just add anim
in your component's data.
You could use a interception observer.( https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API ). There is a polyfill on npm (https://www.npmjs.com/package/intersection-observer) for browsers that don't currently support this API.
@Jamesbillard12 thanks for pointing me in right direction, installed https://github.com/Akryum/vue-observe-visibility, and visibilityChanged (isVisible, entry) { this.isVisible = isVisible // console.log(entry); if (entry.isIntersecting) { this.anim.play(); } }
works
Been struggling to get this to work, any chance you could suggest a way?
this.anim.play();
error: Cannot pass anim object into function. Using this code
error:
vue.esm.js:591 [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'anim' of undefined"