launching animation via external element using javascript + animations not working

Topic: launching animation via external element using javascript + animations not working

Redx64 free asked 1 year ago

How do you trigger an onClick animation via external element using javascript? I can't find anything about it anywhere in the documentation.

Grzegorz Bujański staff answered 1 year ago


  1. Here's an example: button is external element, and has set data-animation-target with The target id.
  2. You mean this example: Note that there are 3 separate instances of the class created here (using the forEach function). Such functionality is not provided. Only one item can be controlled. Item id is retrieved when the class instance is created and will not be refreshed upon change.
  3. Thanks for reporting. We have corrected a documentation error.

Redx64 free answered 1 year ago

I have also tried changing data-attributes using js and jquery like: $("#somebutton").attr("data-animation-target", "#newtarget") and while getattribute reports the values have been changed, it will either continue to use whatever attributes it was originally set to, or if there weren't any it will do nothing at all.

Also within the documentation that you do have, there are places where it seems to reference thing incorrectly. For example- in the API options table it refers to OnEnd, which works, but further down in the 'Callbacks' section it refers to OnStop, which doesn't work.

Redx64 free answered 1 year ago

Or if that's not possible- is there at least a way to use data attributes so you can use one button to control multiple element animations as you show with your collapse example?

i.e: data-target=".multi-collapse" Because data-animation-target=".someclass" will only make the first element with .someclass animate and won't effect the others.

Please insert min. 20 characters.


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



Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: 1.0.0
  • Device: desktop
  • Browser: chrome
  • OS: windows 10
  • Provided sample code: No
  • Provided link: No