鼠标禁用样式(cursor: not-allowed)无效和鼠标禁用事件(pointer-events: none)冲突
·
鼠标禁用样式:cursor: not-allowed;
鼠标禁用事件:pointer-events: none;
元素永远不会成为鼠标事件的target。但是,当其后代元素的pointer-events属性指定其他值时,鼠标事件可以指向其后代元素。
如果同时使用 ,鼠标为默认样式;
cursor: not-allowed;(cursor:no-drop)
pointer-events: none;
解决方法:
-
外层添加盒子将样式分开
外部盒子使用cursor: not-allowed;(cursor:no-drop)
内部盒子使用pointer-events: none;


-
不使用鼠标禁用事件,而是在鼠标点击事件中做判断
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)