mdb.js loaded in head


Topic: mdb.js loaded in head

yddap17 pro asked 7 years ago

Hi there, I have an initialisation problem, while trying to develop a Joomla Template for Joomla 4.0.0. In Joomla in general it is clean code to load the JS-files in the <head>-part of the document. When I do so, the mdb.js gets executed before the <body> is loaded. So I get the following error "Uncaught TypeError: Cannot read property 'addEventListener' of null at Object.Waves.init" on line 13701 When I place the mdb.js in the body everything is ok. What is the best way to load the mdb.js in the head, to avoid this error and to correctly initialise the waves plugin?   Thanks!

Mikołaj Smoleński staff answered 7 years ago

Hi, Our js files are desinged to be loaded in the footer of the page, right before the body closing tag. There is no possibility to load them like this? Loading scripts in the page header may cause many problems or errors with the development. Regards

yddap17 pro answered 7 years ago

Hi, thanks for your answer. Well, then I have to put it in the body. Maybe there will be an option in Joomla to put the js-files with clean code in the body.   Thanks!

FREE CONSULTATION

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

Status

Closed

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