用css的方式取消div的鼠标点击事件

有时候一些场景需要禁止对div等元素进行点击事件,这个时候如果用js的方法会费时费力,代码量还多,这个时候可以用这个css方法来禁止鼠标点击事件

.div{
  pointer-events: auto|none; /*这里的属性为none就是不可被点击*/
}

评论

h
hw_7864

⭐️ Admin快速开发: https://show.cool-admin.com/

赞 0
h
hw_7864

⭐️ 官方文档: https://cool-js.com

赞 0
h
hw_7864

⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld

赞 0