Dynamic loading with javascript


Topic: Dynamic loading with javascript

mgwalk asked 2 months ago

this data-mdb-lightbox-init data-mdb-ecommerce-gallery-init or any data-mdb-* does not play well with dynamic load how the heck do it

I cannot just past the divs with data-mdb-ecommerce-gallery-init because magento does not load mdb fast enough


Kamila Pieńkowska staff answered 2 months ago

You can add Lightbox and eCommerce gallery as plain HTML or add HTML part after pageload and init them with JS init.


mgwalk commented 2 months ago

how code? ddddddddddddddddddddddddddddd


Kamila Pieńkowska staff commented 2 months ago

This is an example of JS init: https://mdbootstrap.com/snippets/standard/kpienkowska/6287864


mgwalk commented 2 months ago

mdb.Lightbox does not exists Why is it not in my 8.0?


mgwalk commented 2 months ago

How do you use the plugins with requirejs-config.js


Grzegorz Bujański staff answered 2 months ago

Unfortunately, we have no experience with Magento and it's hard for us to say anything about it.

Our components are loaded as soon as the JS file of MDB package is loaded. If in your case MDB components appear with a delay, it may mean that Magento loads JS files with a delay.

If mdb.Lightbox doesn't work for you, it may mean that you need to add mdb to window:

import * as mdb from 'mdb-ui-kit'; // lib
window.mdb = mdb;

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
  • User: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 8.0.0
  • Device: comp
  • Browser: ff
  • OS: win11
  • Provided sample code: No
  • Provided link: No
Tags