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!


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

Redx64 free asked 4 years 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 4 years ago


Hi.

  1. Here's an example: https://mdbootstrap.com/docs/standard/content-styles/animations/#subsection-launching-via-external-element button is external element, and has set data-animation-target with The target id.
  2. You mean this example: https://mdbootstrap.com/docs/standard/content-styles/animations/#subsection-accordion? 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 4 years 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 4 years 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.

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: 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