mdb.js executes some operations immediately


Topic: mdb.js executes some operations immediately

freitagm asked 7 years ago

Hi there, it appears as if some initialization operations (such as adding the fade-in/fade-out behavior) are executed immediately once the mdb.js script is processed. That is, this behavior is not added to elements that are added later (for example when using Polymer/WebComponents) or dynamically. Since we are only interested in the first case (elements are added through usage of Polymer/WebComponents), our workaround is currently to defer loading the mdb.js script until after a suitable event has been fired. However, this feels somewhat "hacky". If the mdb.js script behaving as intended, do you have any other ideas on how to solve this problem? Cheers

Jakub Strebeyko staff answered 7 years ago

Dear freitagm,

Thank you for bringing this up. This behavior is intended, yet depending on your desired outcome, you may consider some minor (in contrast to the 'defer mdb loading' way) fixes. They could include (but in no way are limited to) creating a setTimeout(function() {$yourelement.addClass('fadein')}, 0); function on your newly generated components, or a custom one, changing some of the element's re-rendering attributes, like "width". Hope it helps.

With Best Regards,
Kuba


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No