登录 立即注册

首页 > 绿虎论坛 > 建站 > 讨论/求助 (发帖)

标题: 求助--求助  移动端点击触发没反应

作者: @Ta

时间: 2020-03-17发布,2020-03-17修改

点击: 6955

各位大侠,我有一个程序,在移动端上传图片,但是移动端点击没有任何反应,应该是没有触发上传按钮,我写了三个方式都不行

第一个:   $('#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>

[隐藏样式|查看源码]


『回复列表(4|隐藏机器人聊天)』

1.
看着js代码脑壳疼表示一窍不通,有请下一位帮忙解答!
以上来自灌水信息,以下来自小尾巴广告宣传!
小菜狗V1.0版我菜就菜怎么了?https://76wp.cn奇乐网
(/@Ta/2020-03-17 19:31//)

2.

为什么不放个演示地址呢
https://cway.top

(/@Ta/2020-03-17 19:49//)

3. 好像缺少JQ版本文件。
(/@Ta/2020-03-19 13:44//)

4.

正常,请使用上传按钮并设置透明覆盖到你上传按钮的位置
小米MIX2s(白)

(/@Ta/2020-03-19 13:58//)

回复需要登录

5月17日 09:44 星期五

本站由hu60wap6华为CPU驱动

备案号: 京ICP备18041936号-1