<input class="js_upFile cover1" type="file" name="cover" accept="image/*" capture="camera" multiple>
上述代码不能很好地兼容ios,加上下面代码即可。
$(function () {
var nav = navigator.userAgent.toLowerCase();
var isIos = (nav.indexOf('iphone') != -1) || (nav.indexOf('ipad') != -1);
if (isIos) {
$("input:file").removeAttr("capture");
};
})

本文介绍了一段代码在iOS设备上存在的兼容性问题,并提供了解决方案。通过检测用户代理,移除不兼容的属性,确保了在iPhone和iPad上的正常运行。
1207

被折叠的 条评论
为什么被折叠?



