[英]Firing click event on click event, touch screen
HTML: HTML:
<footer>
<a href="#"><div class="footbut" id="chooseFile" onclick="">
<div class="done2 gradGreen" data-bind="visible: picsCount(objectInRoute())>0">
<div class="typcn typcn-tick indone"></div>
</div>
<div class="typcn typcn-camera bigblack"></div>
<span data-bind='text: pickONE("aside",18)'></span>
</div></a>
</footer>
<form class="uppform" action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" id="file" name="image" data-bind="value: upload"/>
<input type="hidden" name="imageObject" data-bind="value: objectInRoute()"/>
<div data-bind="if: upload()">
<div class="first stripe40 gradGold tGold">
<h1 data-bind="text: pickONE('aside',41)"></h1>
</div>
<input type="submit" data-bind="value: upload" id="submit" class="gradGreen"/>
</div>
</form>
JS: JS:
$('#chooseFile').click(function(){
alert ("here");
$('#file').click();
});
(CSS: (CSS:
#file {
display: none;
}
On PC alert works, clicking at #file (=opening choose file) works. 在PC警报上起作用,单击#file(=打开选择文件)起作用。
On my touchscreen (android, mobile phone): alert works, but it does NOT open the popup with camera/documents/gallery.... 在我的触摸屏(Android,手机)上:警报有效,但无法打开包含相机/文档/图库的弹出窗口。...
How can I do it to use on touchscreen or is error somewhere else? 我该如何在触摸屏上使用它或在其他地方出错? Thank you!
谢谢!
If anyone would be interested in this particular situation, it seems that this code solves the problem: 如果有人会对这种特殊情况感兴趣,那么这段代码似乎可以解决问题:
#file {
width: 0;
height: 0;
float: left;
visibility: hidden;
}
Instead of display: none; 而不是显示:无;
I am not really sure, that it will work on all devices, but on my testing one it does. 我不太确定它是否可以在所有设备上运行,但是在我的测试中它确实可以运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.