求助--求助 移动端点击触发没反应
各位大侠,我有一个程序,在移动端上传图片,但是移动端点击没有任何反应,应该是没有触发上传按钮,我写了三个方式都不行
第一个: $('#chooseImage').on(‘click’,function(){
第二个: $(document).on("click","#chooseImage",function(){
下面是第三种,都不行,求大侠帮助。
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta content="telephone=no" name="format-detection">
<meta content="email=no" name="format-detection">
<title>发布活动</title>
<link rel="stylesheet" href="{STATIC_ROOT}/iconfont/iconfont.css"/>
<link rel="stylesheet" href="{STATIC_ROOT}/jqueryweui/css/weui.min.css"/>
<link rel="stylesheet" href="{STATIC_ROOT}/jqueryweui/css/jquery-weui.min.css"/>
<link rel="stylesheet" href="{STATIC_ROOT}/common.css?v=20180830"/>
<script>
var deviceWidth = document.documentElement.clientWidth;
document.documentElement.style.fontSize = deviceWidth / 7.5 + 'px';
</script>
{php echo register_jssdk(false);}
</head>
<body style="background:#f5f5f5;" ontouchstart>
<form id="fieldsform" action="{php echo $this->createMobileUrl('hdrelease',array('op'=>'do'))}" method="post">
<div class="weui-cells__title">上传封面(推荐尺寸600*350)</div>
<div class="weui-cells weui-cells_form">
<div class="weui-cell">
<div class="weui-cell__bd">
<div class="weui-uploader">
<div class="weui-uploader__bd">
<ul class="weui-uploader__files" id="uploaderFiles"></ul>
<div class="weui-uploader__input-box" id="chooseImage"></div>
</div>
</div>
</div>
</div>
</div>
$('#chooseImage').click(function(){
wx.chooseImage({
count: 1, // 默认9
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function(res) {
var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
// 上传照片
wx.uploadImage({
localId: '' + localIds,
isShowProgressTips: 1,
success: function(res) {
serverId = res.serverId;
$.ajax({
url:"{php echo $this->createMobileUrl('getmedia')}",
type:'post',
data:{
media_id:serverId,
tarwidth:600,
tarheight:'',
},
dataType:'json',
success:function(data){
if (data.error == 1) {
$.alert(data.message);
} else {
var imagehtml = '<li class="weui-uploader__file" style="background-image:url('+data.imgurl+')"></li><input type="hidden" name="thumb" id="thumb" value="'+data.realimgurl+'" />';
$('#uploaderFiles').html(imagehtml);
}
}
});
}
});
}
});
});
})
</script>
<script>
wx.ready(function () {
wx.hideOptionMenu();
});
</script>
</body>
</html>
为什么不放个演示地址呢
https://cway.top
正常,请使用上传按钮并设置透明覆盖到你上传按钮的位置
小米MIX2s(白)