菜單本身:http://codepen.io/anon/pen/zxXvoG錯誤的圓形菜單
<!-- language: lang-js -->
$(document).ready(function() {
$('a').hover(function() {
$("ul li").eq($(this).index()).trigger("mouseover");
}, function() {
$("ul li").eq($(this).index()).trigger("mouseout");
});
$('li').hover(function() {
$('a').eq($(this).index()).css('background-color', '#333333');
$(this).css('background-color', '#333333');
}, function() {
$('a').eq($(this).index()).css('background-color', '#666666');
$(this).css('background-color', '#666666');
});
});
$("a")
.on("mouseenter", function() {
$(this).css({
"color": "#00CAF2"
});
})
.on("mouseleave", function() {
var styles = {
"color":""
};
$(this).css(styles);
});
問題:當鼠標懸停在一個鏈接,塊選擇正常,但是當你移動從菜單項標題光標移動到它的塊,somewhy塊「ssssssss8」 ('ul'列表中的第一個塊)也會選擇。
你爲什麼觸發'mouseover'和'mouseout'?我刪除了這些觸發器,它似乎工作正常。 – 2015-03-31 20:48:09
是的,但是當您懸停鏈接時,塊的選擇會消失。所以它現在不能正常工作。 – BigDaddy 2015-03-31 21:05:07
@BigDaddy:最大的問題是你觸發'mouseover'和'mouseout'。這不會是您解決方案的一部分,並且會導致一系列新問題,因此請將其刪除。 – 2015-03-31 21:19:43