2017-02-21 111 views
3

我已經使用queueScript來追加腳本。但它們附在<head>標籤中。我想把它們追加到body標籤的末尾。我該怎麼做?LABjs:如何將腳本附加到主體標記的末尾

var comp; 
    var _DIR_ = "js/vendor/"; 
    var _BOWER_DIR_ = "bower_components/"; 
    $LAB.setOptions({ 
     AlwaysPreserveOrder: true 
    }); 
    $LAB 
     .queueScript(_DIR_+'jquery2.1.3.min.js') 
     .queueScript(_DIR_ + 'angular.min.js') 
     .queueWait() 
     .queueScript(_BOWER_DIR_ + 'angular-bootstrap/ui-bootstrap-tpls.min.js') 
     .queueScript(_DIR_+'angular-animate.min.js') 

     .runQueue(); 
</script> 
+0

請把一些代碼用一個例子連結,讓我們可以檢查並幫助周到,謝謝 –

+0

@Anant添加的代碼正如你所提到 –

回答

0

你能用嗎?

document.head.appendChild('your scripts here') 

並抓住你的腦袋像這樣或東西:

var head = document.getElementsByTagName("head")[0]; 
+0

我不希望它將它追加到標題上。爲了達到性能目的,需要將它們附加在主體標籤的末尾。不知道LABjs是在加載html之後還是在開始時加載腳本文件 –

相關問題