Advertisement
artemsemkin

Kinsey template: Update ScrollTrigger when content container dimensions are changed

Apr 30th, 2023
1,539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Update ScrollTrigger when content container
  3.  * dimensions are changed
  4.  */
  5. const ro = new ResizeObserver(debounce(() => {
  6.   ScrollTrigger.refresh();
  7. }, 250));
  8.  
  9. document.addEventListener('arts/barba/transition/start', () => {
  10.   ro.unobserve(window.$pageContent[0]);
  11. });
  12.  
  13. document.addEventListener('DOMContentLoaded', () => {
  14.   ro.observe(window.$pageContent[0]);
  15. });
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement