标签:android style blog color io os ar div sp
ios下的Safari真是傲娇啊,坑好多。
首先上代码
<!DOCTYPE html> <html> <head> <title>122</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no"> </head> <body> <div> adfafasdfasdfasdfasfdasdf<br/> adfafasdfasdfasdfasfdasdf<br/>adfafasdfasdfasdfasfdasdf<br/> adfafasdfasdfasdfasfdasdf<br/> adfafasdfasdfasdfasfdasdf<br/>adfafasdfasdfasdfasfdasdf<br/>adfafasdfasdfasdfasfdasdf<br/> adfafasdfasdfasdfasfdasdf<br/>adfafasdfasdfasdfasfdasdf<br/>adfafasdfasdfasdfasfdasdf<br/> </div> <div> <img src="__IMG__/indexbanner.png" alt=""/> </div> <script src="__JS__/jquery-1.11.1.min.js"></script> <script> $(function(){ $(‘body‘).on("click", function(e){ alert("click"); }); }) </script> </body> </html>
提问:点击在文字上和点击在图片上是否都会弹出“click”呢?
呵呵呵呵呵呵,结果是只有第二个img的点击能正确触发click,点击div里的文字完全没效果。
解决办法就是绑定到 “touchend” 事件。。。
这个bug只有在ios的Safari下才能出现,桌面端、android端都没有问题,苹果真是傲娇啊。。
ps:移动端的点击处理还是得尽量用touch类的事件。。click坑太多了。
标签:android style blog color io os ar div sp
原文地址:http://www.cnblogs.com/hongchenok/p/3975689.html