富贵资源网 Design By www.hznty.com

我的风格你懂得,具体详情介绍如下

关键代码如下所示:

function AsyncLoad(V_tag,V_src)
{
if (V_tag == "script") {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = V_src;
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
s.onload = function () {
if (V_src == "../Content/Scripts/jquery-2.1.1.min.js") {
AsyncLoad("script", "../Content/Scripts/public-effect.js");
AsyncLoad("script", "../Content/Scripts/d3.v3.min.js");
AsyncLoad("script", "../Content/Scripts/Common.js");
AsyncLoad("script", "../Content/Scripts/mobilePie.js");
}
if (V_src == "../Content/Scripts/d3.v3.min.js")
{
AsyncLoad("script", "../Content/Scripts/Ticket/MyPCs.js");
}
}
} else {
var s = document.createElement('link');
s.async = true;
s.rel = "stylesheet"
s.href = V_src;
var x = document.getElementsByTagName('link')[0];
x.parentNode.insertBefore(s, x);
s.onload = function () {
}
}
}
window.onload = function () {
AsyncLoad("link", "../Content/stylesheets/swiper-3.2.7.min.css");
AsyncLoad("script", "../Content/Scripts/jquery-2.1.1.min.js");
AsyncLoad("script", "../Content/Scripts/swiper-3.2.7.jquery.min.js");
}

以上所述是小编给大家介绍的异步加载JS、CSS代码的全部叙述,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com