我有一个加载到 DIV 中的图像:
.playerSkipForward
{
background-image: url("../images/player/forward.png");
background-repeat: no-repeat;
cursor: pointer;
}
带有悬停图像集
.playerSkipForward:hover
{
background-image: url("../images/player/forward-hover.png");
}
然后在某个时刻,我向其中添加了一个类,该类会更改图像并使其看起来“不活动”
$(track).parents().find('.playerSkipForward').addClass('playerSkipForward_inactive')
像这样在我的 CSS 中声明了新的(非活动的)类
.playerSkipForward_inactive
{
background-image: url("../images/player/forward_inactive.png");
background-repeat: no-repeat;
cursor: default;
}
图像正确更改为上述类中的图像。但是,它仍然悬停并改变颜色。我不想添加类似的解除绑定,.on('hover')
因为绑定可能很难管理。有没有办法只用添加的 css 类来覆盖悬停?