Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!

webshapers priority asked 4 years ago


I want to add a class to an element, when it scrolls into view. Or maybe even do other weird things. Is there any chance to make use of existing resources, like a callback function or an additional attribute for the animations (data-animation-start="onScroll"). I'd like to know more about the libraries used. Thank you!


Grzegorz Bujański staff answered 4 years ago


I understand that this element is supposed to start animating when it appears on the screen after scrolling the page? Then you can use the event listener animationstart and do whatever you want when the element starts animating.

const myElement = document.querySelector('#myElement');    
myElement.addEventListener('animationstart', () => {
  // do something
});


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: 2.2.1
  • Device: any
  • Browser: any
  • OS: any
  • Provided sample code: No
  • Provided link: No