toddmotto/fluidvids

Does not work when added in header

Closed this issue · 1 comments

I was just testing it out and it did not work for me at first. The reason was that I add the js to the header. I know it is not best practice but I was just testing the code.

No vanilla JavaScript works in the <head> unless it's called onload or DOM ready. You can either put the function inside a DOM ready wrapper or add it just before the </body> closing tag, which is where all JS should always go.