Topic: Modal cookie and modal popup dont work

demzl25 pro asked 1 year ago


Expected behavior

When you enter the website the Modal cookie and Modal popup need to work.

Actual behavior

Modal cookie and popup modal dont work on my website I m not sure what is wrong i got error in console Uncaught ReferenceError: mdb is not defined https://www.regresija-hipnoza.si/js/custom.js:71

Resources (screenshots, code snippets etc.)

Link to my website: https://www.regresija-hipnoza.si/


Mateusz Lazaru staff answered 1 year ago


It happens because you added defer to the MDB import.

<script defer src="js/mdb.min.js"></script>

The defer delays the loading of the package import, while custom.js loads immediately. As a result, the browser tries to initialize the modal before the MDB import.

solution: remove defer from <script defer src="js/mdb.min.js"></script> or add defer to <script src="js/custom.js"></script>


demzl25 pro commented 1 year ago

Thanks that solves issue!



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: Pro
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 5.0.0
  • Device: All
  • Browser: Chrome 97.0.4692.99
  • OS: window 10
  • Provided sample code: No
  • Provided link: Yes