Mootools - Check for css or js files

天涯浪子 提交于 2019-12-13 06:57:54

问题


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


回答1:


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");
    }
});


来源:https://stackoverflow.com/questions/5238117/mootools-check-for-css-or-js-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!