alicelieutier / smoothScroll

A teeny tiny smooth scroll script with ease-in-out effect and no jQuery.
MIT License
537 stars 127 forks source link

remove DOMContentLoaded listener #22

Open stevenvachon opened 8 years ago

stevenvachon commented 8 years ago

Just run the code when the factory is ran. The reason for this is the code may never run due to <script async>

I already handle such myself with:

function init() {
  require("es6-promise").polyfill();
  require("smoothscroll");
}

if (document.readyState !== "loading") {
  init();
} else {
  document.addEventListener("DOMContentLoaded", init);
}

But my fragment/hash links are not getting the event listeners.