Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default {
- install(Vue) {
- Vue.directive('sticky-el', {
- inserted(el, binding, vnode, oldVnode) {
- if (window.innerWidth > 768) {
- window.observer = new IntersectionObserver((entry) => {
- // Do something with the **entry
- },{
- threshold: 1.0
- });
- window.observer.observe(el);
- }
- },
- unbind(el, binding, vnode, oldVnode) {
- window.oberver.disconnect()
- }
- });
- }
- };
Add Comment
Please, Sign In to add comment