svg pointer-events="auto"
svg pointer-events="auto"
<svg width="640" height="480" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" pointer-events="none"> <g > <animate attributeName="opacity" from="0" to="1" dur="3s" begin="click" restart="always" repeatCount="3"></animate> <rect x="150" y="50" width="100" height="50" pointer-events="auto"> <animate attributeName="x" from="0" to="222" dur="3s" begin="click" restart="always" repeatCount="3"></animate> </rect> <rect x="150" y="180" width="100" height="50" > <animate attributeName="x" from="0" to="222" dur="3s" begin="click" restart="always" repeatCount="3"></animate> </rect> </g> </svg> </body> </html>
pointer-events="auto" 用了这个 标签 就代表可以触发事件了具体原理就是 按照事件冒泡 判断 pointer-events="auto" 来决定是否触发事件 一旦auto 往上冒泡都会触发事件 https://codepen.io/a6965921/pen/vYyrGeP
如果遇到什么不懂的地方直接关注公众号留言(本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。)
作者:newmiracle
出处:https://www.cnblogs.com/newmiracle/