鼠标禁用样式(cursor:not-allowed)和鼠标禁用事件(pointer-events: none)

365现金app 📅 2025-12-05 19:20:29 👤 admin 👁️ 7205 ❤️ 557
鼠标禁用样式(cursor:not-allowed)和鼠标禁用事件(pointer-events: none)

原理

1、 鼠标禁用样式

cursor: not-allowed;

该方法只能实现样式上的不可点击,点击依然会触发相应的点击事件。

2、鼠标禁用事件

pointer-events: none;

该样式会阻止默认事件,但是鼠标样式会变成箭头的样子。

解决方法

解决办法1

外层添加一个盒子将样式分开:

外层盒子使用cursor: not-allowed;

内部盒子使用pointer-events:none;

已参加

.right_bottom_disable {

width: 275px;

height: 34px;

line-height: 34px;

background: #9BC3FF;

font-size: 16px;

color: #FFFFFF;

text-align: center;

cursor: not-allowed;

div {

pointer-events: none;

}

}

解决办法2

使用cursor: not-allowed;然后执行点击事件,在点击事件中阻止触发。

相关推荐

“百度外卖”为何把自己给“卖”了
365现金app

“百度外卖”为何把自己给“卖”了

📅 07-06 👁️ 8755
【轻松办税】如何在电子税务局App中查验发票真伪?
BET体育365官网首页

【轻松办税】如何在电子税务局App中查验发票真伪?

📅 10-27 👁️ 9995
米兔儿童电话手表怎么关机
365现金app

米兔儿童电话手表怎么关机

📅 08-12 👁️ 7966