Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript document.ready(function()在android设备上不工作_Javascript_Android - Fatal编程技术网

Javascript document.ready(function()在android设备上不工作

Javascript document.ready(function()在android设备上不工作,javascript,android,Javascript,Android,我正在使用document.ready()函数,它在windows和ios设备上工作正常,但在android设备上不工作。请帮助我 //js文件夹中的min.js //jquery.js $(document).ready(function(){ // $("#ios").hide(); // to hide ios div to hide android div $("#android").hide(); // $("#iOSP

我正在使用document.ready()函数,它在windows和ios设备上工作正常,但在android设备上不工作。请帮助我

//js文件夹中的min.js //jquery.js

$(document).ready(function(){ //
        $("#ios").hide();         // to hide ios div  to hide android div
        $("#android").hide();        // $("#iOSP").hide(); ios heading div
     var userAgent = navigator.userAgent || navigator.vendor || window.opera;    
// user agent 
    if( userAgent.match( /iPad/i ) || userAgent.match( /iPhone/i ) || userAgent.match( /iPod/i ) )  // // user agent checks if device is ios 
    {
        $("#ios").show(); // when ios found showing ios div 
        $("#android").hide(); // and hiding  android div
    }else 
    { 
        $("#ios").hide();  // other wise hide  and  
        $("#android").show();  // show android
        $("#iOSP").hide();     // ios div

    }

// This code is running fine on ios device and also on desktop with os //widows7 

[enter link description here][1]
}); 


</script>
$(文档).ready(函数(){//
$(“#ios”).hide();//隐藏ios div的步骤隐藏android div的步骤
$(“#android”).hide();/$(“#iOSP”).hide();ios标题div
var userAgent=navigator.userAgent | | navigator.vendor | | window.opera;
//用户代理
if(userAgent.match(/iPad/i)| | userAgent.match(/iPhone/i)| | userAgent.match(/iPod/i))///用户代理检查设备是否为ios
{
$(“#ios”).show();//当发现ios显示ios div时
$(“#android”).hide();//和隐藏android div
}否则
{ 
$(“#ios”).hide();//其他明智的隐藏和
$(“#android”).show();//显示android
$(“#iOSP”).hide();//ios div
}
//这段代码在ios设备上运行良好,在带有os//widows7的桌面上也运行良好
[在此处输入链接说明][1]
}); 

如果您使用的是phonegap,您应该检查
文档。addEventListener(“deviceready”,onDeviceReady,false);
不,我正在制作api,在android应用程序中添加此页面是为了显示android的div,而在ios中显示的是ios div。它在ios和windows 7上工作正常,但在android设备上不工作。我该怎么办?我在和android 4.01设备上遇到同样的问题。如果您使用phonegap,您应该检查
document.addEventListener(“deviceready”,onDeviceReady,false);
否我正在制作api,在android应用程序中添加此页面是为了显示android的div,在ios中显示的是ios div。它在ios和windows 7上工作正常,但在android设备上不工作。我该怎么办?我在android和android 4.01设备上也有同样的问题。