lemonsaurus / django-simple-bulma

Django application to add the Bulma CSS framework and its extensions
MIT License
137 stars 17 forks source link

Scripts using window.onload #25

Closed gdude2002 closed 5 years ago

gdude2002 commented 5 years ago

Currently, we have multiple scripts making use of window.onload. This presents some issues, mainly that you can only have one function assigned to window.onload by default.

I propose that we make use of the newer DomContentLoaded event. This will be fired once the DOM has been loaded up, but before assets like images have fully loaded - which is generally what we want.

It's simple enough:

window.addEventListener('DOMContentLoaded', (event) => {
    console.log('DOM fully loaded and parsed');
});