不同分辨率下获取不同js文件
[日期:2022-12-19] 来源:云南龙头科技有限公司 作者:云南龙头科技有限公司 阅读:787次
判断浏览器是手机还是pc
<script type="text/javascript">
var type = navigator.userAgent.match(/.*Mobile.*/)?"mobile":"pc";
if(type=="pc"){
$.getScript("http://vc3.cn/Public/home/js/jquery.flexslider.js",function(){
});
}
</script>
jquery的写法
<script type="text/javascript">
var strFullPath=window.location.href;
var strPath=window.location.pathname;
var pos=strFullPath.indexOf(strPath);
var prePath=strFullPath.substring(0,pos);
if($(window).width()>789){
$.getScript(prePath+"/Public/home/js/jquery.flexslider.js",function(){});
}
</script>