mdbootstrap / material-design-for-bootstrap

Important! A new UI Kit version for Bootstrap 5 is available. Access the latest free version via the link below.
https://mdbootstrap.com/docs/standard/
MIT License
9.34k stars 1.15k forks source link

Waves cannot be initialised due to document.body not being available #165

Closed nKittie closed 6 years ago

nKittie commented 6 years ago

Expected behavior

Wave.init not to throw an exception

Actual behavior

With mdb.js script in the HEAD part of the page, Waves.init fails on the line: body.addEventListener('mousedown', showEffect, false); due to document.body = null. At this point document object exists and has head but no body. Moving <script src=mdb.js... line to after the body in DOM makes this work fine.

Your working environment and MDB version information

HTML5, Windows 10, Chrome 66, MDB free version

Resources (screenshots, code snippets etc.)

image

For every question of technical nature, in order to get the most detailed answer as soon as possible, ask on our dedicated Support Forum

cjmaxik commented 6 years ago

Actually, why do you need the scripts in the HEAD? Even the Waves docs itself instruct you to put the scripts before BODY tag closes.

nKittie commented 6 years ago

Fair enough, didn't see that requirement!