CSS3 pointer-events(阻止hover、active、onclick等触发事件)

html-css07

CSS3 pointer-events(阻止hover、active、onclick等触发事件),第1张

Firefox 3.6+和chrome 2.0+ 以及safari 4.0+都支持这个CSS3属性,IE6/7/8/9都不支持(IE11又支持,不过很好的一点是在ie中给a加disabled 点击事件自动无效。),Opera在SVG中支持。 但是 该属性HTML中 不支持

1、提交页面,提交按钮点击后,添加这个样式属性(style="pointer-events"),来防止重复提交

2、让链接不能点击

3、让鼠标点击穿透上方的 div

body {

background-color: #E6F0E6

filter: invert(0%)

}

.clicked{

background-color: #000000

filter: invert(100%)

} document.body.onclick =function(){ document.body.className='clicked'}