我正在爲純CSS中的按鈕創建懸停效果。但是我希望這種效果只有在鼠標懸停發生時纔會發生。但是當觸摸設備中的按鈕出現觸摸事件時,會發生懸停效果。我怎樣才能限制這種效果只有非觸摸設備?如何在CSS中只觸摸非觸摸設備?
.toolbar-button:not(.media-control):not(#page-count-button):hover:enabled:after {
content: "";
display: block;
width: 37px;
height: 34px;
background-image:-webkit-gradient(linear, top, bottom, from(rgba(255,255,255, 0)), color-stop(0.65, rgba(255,255,255, 0.1)), to(rgba(255,255,255, 0.6)));
background-image:-webkit-linear-gradient(rgba(255, 255, 255, 0), rgba(255,255,255, 0.15) 70%, rgba(255,255,255, 0.6));
background-image: -moz-linear-gradient(rgba(255, 255, 255, 0), rgba(255,255,255, 0.15) 70%, rgba(255,255,255, 0.6));
background-image: -ms-linear-gradient(rgba(255, 255, 255, 0), rgba(255,255,255, 0.15) 70%, rgba(255,255,255, 0.6));
background-image: -o-linear-gradient(rgba(255, 255, 255, 0), rgba(255,255,255, 0.15) 70%, rgba(255,255,255, 0.6));
background-image: linear-gradient(rgba(255, 255, 255, 0), rgba(255,255,255, 0.15) 70%, rgba(255,255,255, 0.6));
}
注意:我在這項工作中使用了jQuery-touch-punch。