-webkit-grabbing仅适用于Safari中的按钮

时间:2016-12-21 13:45:03

标签: css safari cursor

我对 Safari -webkit-grabbing的{​​{1}} css参数有不同的行为。它仅适用于cursor元素,而不适用于<button

<div>
.a {
  background-color: green;
  width: 200px;
  height: 200px;
 }

.b {
  background-color: yellow;
  width: 200px;
  height: 200px;
 }

.grab {
  cursor: grab;
  cursor: -moz-grab;
  cursor: -webkit-grab;
}

.grab:active {
  cursor: grabbing;
  cursor: -moz-grabbing;
  cursor: -webkit-grabbing;
}

对于 Chrome Firefox ,它可以正常运行。

1 个答案:

答案 0 :(得分:0)

禁用用户选择解决了我的问题:

...

.grab {
  cursor: grab;
  cursor: -moz-grab;
  cursor: -webkit-grab;

  -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Chrome/Safari/Opera */
     -khtml-user-select: none; /* Konqueror */
       -moz-user-select: none; /* Firefox */
        -ms-user-select: none; /* Internet Explorer/Edge */
            user-select: none; /* Non-prefixed version, currently
                                  not supported by any browser */
}

...

取自https://stackoverflow.com/a/4407335/118125