移动端事件点透问题

在移动WEB开发中,有时候可能会出现点透问题,本随笔将围绕这个TAP点透问题,详细的讲述以下几点:

  到底什么是点透?为什么会出现点透?如何避免出现点透?如果不可避免的出现了,如何解决解决点透问题?(我说的是移动端,不是pc端

1、什么是点透?

以下情况,在B元素上有半透明灰色遮盖层A,黄色B元素内有可点击链接。

移动端事件点透问题

布局代码如下

<html lang="en"> <head> <meta charset="UTF-8"> <title>点透问题</title> <style> *{ margin: 0px; padding:0px; } #A{ /*灰色色半透明遮盖层A*/ width: 300px; height: 300px; background-color: rgba(255,0,0,0.25); } #B{ /*黄色内容层B*/ width: 240px; height: 240px; background-color: yellow; position: absolute; left: 30px; top: 30px; z-index: -1; } #console{ /*绿色状态输出框*/ border: 1px solid green; position: absolute; top: 300px; width: 100%; } </style> </head> <body> <div></div> <div> <a href="http://www.cnblogs.com/shizk/">https://www.cnblogs.com/shizk/</a> </div> <div></div> </body> </html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wpdpyz.html