Created
October 24, 2017 08:27
-
-
Save imitronov/0c2afd2af0636c05308a4aa03de018cb to your computer and use it in GitHub Desktop.
Отложенная загрузка
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var scripts = new Array( | |
), | |
css = new Array( | |
'/assets/css/main.min.css' | |
); | |
function downloadJSAtOnload() { | |
var element; | |
for(var i = 0; i < scripts.length; i++){ | |
element = document.createElement("script"); | |
element.src = scripts[i]; | |
element.type = 'text/javascript'; | |
document.body.appendChild(element); | |
} | |
for(var i = 0; i < css.length; i++){ | |
element = document.createElement("link"); | |
element.href = css[i]; | |
element.type = 'text/css'; | |
element.rel = 'stylesheet'; | |
document.body.appendChild(element); | |
} | |
} | |
if (window.addEventListener) | |
window.addEventListener("load", downloadJSAtOnload, false); | |
else if (window.attachEvent) | |
window.attachEvent("onload", downloadJSAtOnload); | |
else window.onload = downloadJSAtOnload; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment