我设置了精灵悬停事件和航点Jquery事件,根据主导航菜单上的锚点/滚动更改css -
jfiddle示例可以在这里找到:http://jsfiddle.net/LhLpm39p/17/
$('#news').waypoint(function (direction) {
if (direction === 'up') {
$('#news-menu').css({
"background-position": "0 0",
"color": "#fff"
});
}
}, {
offset: '100%'
}).waypoint(function (direction) {
if (direction === 'down') {
$('#news-menu').css({
"background-position": "0 100%",
"color": "#00a4f0"
});
}
}, {
offset: '50%'
}).waypoint(function (direction) {
if (direction === 'down') {
$('#news-menu').css({
"background-position": "0 0",
"color": "#fff"
});
}
}, {
offset: '0%'
});
在点击任何导航之前悬停工作正常,但是一旦你点击一个并触发航点,悬停就会被禁用!
我该如何纠正这个问题?
答案 0 :(得分:0)
这可能是CSS特异性问题之一。只需用!important
进行装饰即可。这应解决问题:
.menu:hover {
background: url("http://www.solidbackgrounds.com/images/two/950x350/950x350-vegas-gold-venetian-red-two-color-background.jpg") 0 100%!important;
color: #00a4f0!important;
}