Mootools-检查CSS或JS文件 [英] Mootools - Check for css or js files
本文介绍了Mootools-检查CSS或JS文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道我可以使用Asset类来附加新的CSS或JS文件.但是,如果我想检查资产之前是否存在css或js文件? 有一种方法? 谢谢
I know for append new css or js file I can use Asset class. But if i want check if css or js files are present before Asset?? There is a way? Thx
推荐答案
您可以在将其带入资产时为其分配ID,并检查dom是否存在:
you can assign ids to your assets as you bring them in and check against the dom for their presence:
Asset.javascript("https://github.com/DimitarChristoff/tippable/raw/master/Source/tippable.js", {
id: "someid",
onload: function() {
alert("loaded");
if (document.id("someid"))
alert("already loaded");
}
});
这篇关于Mootools-检查CSS或JS文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文