Guest User

Untitled

a guest
Jul 8th, 2024
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <script>
  2. document.addEventListener('DOMContentLoaded', () => {
  3. const observerOptions = {
  4. root: null,
  5. rootMargin: '0px',
  6. threshold: 0.1
  7. };
  8.  
  9. const fadeInElements = document.querySelectorAll('#home_products_archive_1 li, #home_categories_archive li');
  10.  
  11. const observer = new IntersectionObserver((entries, observer) => {
  12. entries.forEach(entry => {
  13. if (entry.isIntersecting) {
  14. entry.target.classList.add('fade-in');
  15. observer.unobserve(entry.target);
  16. }
  17. });
  18. }, observerOptions);
  19.  
  20. fadeInElements.forEach(element => {
  21. observer.observe(element);
  22. });
  23. });
  24. </script>
Advertisement
Add Comment
Please, Sign In to add comment