I include an external theme in Meteor. It has some scripts loaded to the end of the body tag. The tag <script>does not work if inside <body>the Meteor template.
The topic uses js such as Bootstrap, jquery and other other, possibly external JS libraries (which are also placed at the end, before </body>. The last script is a custom.jsscript that is thematic. Inside the script there are two anonymous functions besides regular function statements , two ifblocks at the top level, callback $(document).readyand callback $(window).load.
What is the best way to load scripts with the lowest temperature? I tried moving all the scripts inside <head>the Meteor template. But some effects are missing. I think it may $(window).loadnot be called at the right time. So I call it inside Template.scriptAppend.rendered, where scriptAppend is the template for partial right to the end </body>. I also move two anonymous functions and two blocks ifinside $(window).load. It works, but it’s such a hassle. Is there any way to leave the script as is?
First of all, I initially just think that I will use jQuery to add tags <script>inside Template.scriptAppend.rendered, but there seems to be no effect, and I have no idea why.
So my questions are: (1) is there a way to leave the script as it is, and (2) when is Meteor <head>processed anyway? Apparently $ (window) .load is not executing at the right time, as expected by the script.
source
share