-2

I would like to know if the function $(window).on('load', function() { ... } in preload-min.js takes in consideration all the code in the index.html and main-min.js before triggering.

index.html

<html>
  <body>

    ... html code ...

    <script src="dist/main-min.js"></script>
    <script src="dist/preloader-min.js" charset="utf-8"></script>
  </body>
</html>

main-min.js

$(document).ready(function() {

 ... js code ...

})

preload-min.js

$(document).ready(function() {
  $(window).on('load', function() {

    ... js code ...

  });
})
Diego Oriani
  • 1,647
  • 5
  • 22
  • 31
  • 2
    Cannot answer this questions with the limited information and script provided. Please include as much of your script and markup that is necessary to recreate your issue. – Korgrue Jun 30 '17 at 14:33
  • @ Korgrue I only focusing on the main query now. Thank you for the patience. – Diego Oriani Jun 30 '17 at 15:13

1 Answers1

1

Yes, preloader-min.js will wait until all of the content in index.html is loaded. The two scripts will behave the same as if they were placed in one <script> tag in index.html.

ceejayoz
  • 176,543
  • 40
  • 303
  • 368