判断是否为移动设备

var mobileAgent = new Array("iphone", "ipod", "ipad", "android", "mobile", "blackberry", "webos", "incognito", "webmate", "bada", "nokia", "lg", "ucweb", "skyfire");
    var browser = navigator.userAgent.toLowerCase();
    var isMobile = false;
    for (var i=0; i<mobileAgent.length; i++){
        if (browser.indexOf(mobileAgent[i])!=-1){
            isMobile = true;
            $(".bodya .u1").css("background","green");
         }
    }
js

 

posted @ 2016-08-08 16:16  dongxiaolei  阅读(215)  评论(0编辑  收藏  举报