点击并拖动引导按钮会导致不正确的高亮显示

Click and drag on bootstrap button leads to incorrect highlighting

本文关键字:不正确 显示 高亮 按钮 拖动      更新时间:2023-09-26

单击引导按钮后,如果您拖动鼠标并将其释放到其他地方,则该按钮将保持高亮显示,就好像您仍然悬停在它上面一样(不活动,只是高亮显示)。是否有任何方法使用javascript或jQuery取消突出显示?我唯一能想到的就是在其他地方模拟鼠标点击。

在bootstrap主页上测试

你可以通过在选择器中添加这个来让按钮在拖动时没有选择:

user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
-moz-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;

或者你可以指定你想要选择的颜色通过添加:

::selection {
  background: #fff;
}
::-moz-selection {
  background: #fff;
}