【发布时间】:2013-03-06 14:33:24
【问题描述】:
大家好 我创建了一个基于 jquery 的多级导航菜单,当 onMouse 每个子导航直接出现在悬停/单击的列表项下方时。我现在遇到的问题是所选父项的 bg-color 没有像 subnav bg 一样改变。奇怪的是它在 IE 中而不是在 FF 中工作。这是我写的jquery脚本。
演示 - http://jsfiddle.net/pixelfx/xRVVv/4/
$(document).ready(function() {
$("ul#topnav li").hover(function() { //Hover over event on list item
$(this).css({ 'background' : '#1376c9 url(topnav_active.gif) repeat-x'});
$("ul#topnav li.active1").css({ 'background' : 'CCFFCC'});
$(this).find("span").show(); //Show the subnav
} , function() { //on hover out...
$(this).css({ 'background' : 'none'});
$(this).find("span").hide(); //Hide the subnav
$(this).find("span.active").show(); //Hide the subnav
$(this).find("li.active1").show(); //Hide the subnav
$("li.active1").css({ 'background' : '1376c9'});
});});
【问题讨论】: