D
D
Dmitry Kim2015-09-30 06:11:46
JavaScript
Dmitry Kim, 2015-09-30 06:11:46

How to omit javascript loading in page footer?

The HEAD of the document contains jQuery.js and Bootstrap.js .
If you lower them down on the page (so that they are loaded after the entire page is loaded), then naturally such code on the page as $(function(){...});
What is the best way to do this, or to score and leave it as it is? Or something to replace $(function(){}); ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Inchin ☢, 2015-09-30
@kimono

And if several such places are scattered throughout the code?

Well, in extreme cases, you can throw in a hat:
window.$ = function(f){
   window.addEventListener("load", f);
};

N
Nikita Musikhin, 2015-09-30
@jestoky

maby $(function(){...}); move even lower than bootstrap and jquery loading?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question