Topic: MDB scripts conflict with WordPress

forester pro asked 8 years ago


Hello! MDB scripts (mdb.js) try to use global var $, which might not be defined globally in WordPress environment. To resolve this issue i've temporary wrapped whole mdb.js contents into (function ($) { /* your scripts here */ }(jQuery));. Do you have any other suggestions? Kind regards! Artem

Reland Pigte free answered 7 years ago


I fixed the issue on my theme by loading the jquery version 2.2.3. Hope this helps for those who are facing this issue. Cheers, Reland

Michal Szymanski staff answered 8 years ago


Unfortunately we didn't release a new version with that fix yet. We apologize for the delay. In a very short time, our project has grown very quickly and we are overloaded with the work. We are currently enlarging the team to provide our users the best possible support and in the same time develop MDB. Thank you for your patience.

Daniel pro answered 8 years ago


can you mention what "next release" is? Is this implemented? Thanks you!!

Dawid Adach pro answered 8 years ago


As we discussed, we will release fix in next MDB version. Thank you for your contribution :)

forester pro answered 8 years ago


Hi, Dawid! I just sent you files at your email. Thanks!

Dawid Adach pro answered 8 years ago


Hi @forester , Could you mail me your wp template? We didn't face that issue while creating other wp templates with MDB, I would like to have a closer look at this issue. Could you mail me at d.adach@mdbootstrap.com ? Thanks

forester pro answered 8 years ago


Hello, Dawid! Definitely i have. Everything works good after script modification described above. But i don't want do modifications in your scripts. I just mean that for using jQuery in WordPress we need to wrap scripts in construction above. Like described in docs https://make.wordpress.org/core/handbook/best-practices/coding-standards/javascript/#globals. Otherwise we'll get an error that variable $ is not defined. So, i have to modify mdb.js and wrap its contents into construction above, to ensure that $ is defined and means jQuery. But i believe that there should be a better solution, without modifing your scripts. That's why i ask. Regards! Artem

Dawid Adach pro answered 8 years ago


Dear forester, Have you loaded jQuery ?

Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: No