onClick 事件在平板电脑、ipad 上不起作用?它在 PC 浏览器上完美工作,但不适用于触摸事件,我尝试了 .binding()、.on() 和很多东西,但它们没有给出 100% 的结果。
我怎样才能让它在ipad、平板电脑上工作?
<div id="id1" alt='div1' class="sliderImage" width="300" height="360" onclick="" style="visibility:hidden;background-image:url('img/img1.jpg'); border:solid; border-color: black;">You've styled the div to have a set width of 100px. At a reasonable font size, that's too much text to fit in 100px. Without doing anything, </div>
<div id="id2" alt='div2' class="sliderImage" width="300" height="360" onclick="" style="visibility:hidden;background-image:url('img/img2.jpg'); border:solid; border-color: black;">this is 2</div>
你需要使用 touchstart 我给你一个小例子,
$('elementid').on('click touchstart', function() {
console.log('1');
});
当触摸点放置在触摸表面上时,将触发 touchstart 事件。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)