Guest User

Untitled

a guest
Sep 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. export default {
  2. install(Vue) {
  3. Vue.directive('sticky-el', {
  4.  
  5. inserted(el, binding, vnode, oldVnode) {
  6. if (window.innerWidth > 768) {
  7.  
  8. window.observer = new IntersectionObserver((entry) => {
  9. // Do something with the **entry
  10. },{
  11. threshold: 1.0
  12. });
  13. window.observer.observe(el);
  14. }
  15. },
  16. unbind(el, binding, vnode, oldVnode) {
  17. window.oberver.disconnect()
  18. }
  19. });
  20. }
  21. };
Add Comment
Please, Sign In to add comment