首页登陆欢迎您!
首页登陆 > 运维知识 > 异步加载JS、CSS代码_javascript技巧_脚本之家

异步加载JS、CSS代码_javascript技巧_脚本之家

时间:2019-12-11

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

废话不多说,直接给大家贴代码了,代码解决一起问题!

关键代码如下所示:

下面一段代码给大家介绍js无缝滚动实例代码:

function AsyncLoad{if  {var s = document.createElement;s.type = 'text/javascript';s.async = true;s.src = V_src;var x = document.getElementsByTagName[0];x.parentNode.insertBefore;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;s.async = true;s.rel = "stylesheet"s.href = V_src;var x = document.getElementsByTagName[0];x.parentNode.insertBefore;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");}
无标题文档*{margin:0px;padding:0px;}#div1{width:830px; height:166px; margin:50px auto;position:relative;background:white;overflow:hidden;}#div1 ul li{float:left; width:174px; height:166px; list-style:none;}ul{position:absolute;}window.onload=function(){var oDiv=document.getElementById;var oUl=oDiv.getElementsByTagName[0];var aLi=oUl.getElementsByTagName;var speed=3oUl.innerHTML=oUl.innerHTML+oUl.innerHTML;oUl.style.width=aLi[0].offsetWidth*aLi.length+'px';function move (){if(oUl.offsetLeft<-oUl.offsetWidth/2){oUl.style.left='0';}if{oUl.style.left=-oUl.offsetWidth/2+'px';}oUl.style.left=oUl.offsetLeft+speed+'px';};var timer=setInterval;oDiv.onmouseover=function(){clearInterval;};oDiv.onmouseout=function(){timer=setInterval;}document.getElementsByTagName[0].onclick=function(){speed=-3;};document.getElementsByTagName[1].onclick=function(){speed=3;};};向左走向右走

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

分享到侧边栏js代码如下所示:

上一篇:JavaScript对象数组如何按指定属性和排序方向进行排序_javascript技巧_脚本之家 下一篇:没有了