2017-02-21 108 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之后还是在开始时加载脚本文件 –

相关问题