用js或jq实现导航点击后换背景图片

如图静态代码我已经写好了:就想用jq或js简单点方法,点击到其他的内容时候变为黄色背景,其他的保持蓝色不变。
字体的宽度:.snav ul li a { display:block; width:102px; height:39px; line-height:39px; text-align:center;font-size:13px; color:#ffffff; text-decoration:none;font-weight:bold;}划入到字体的背景图片:.snav ul li a:hover{background:url(../images/snavhover.png) no-repeat;width:102px;height:39px;}公司首页的背景图片:.snavcheck{background:url(../images/snavhover.png) no-repeat;width:102px;height:39px;}
求高手帮忙写一下代码

第1个回答  推荐于2016-01-15
.snav {background:url(../images/snavhover.png) no-repeat;width:102px;height:39px;} //黄色背景的样式
.snavcheck{background:url(../images/snavhover.png) no-repeat;width:102px;height:39px;}
//蓝色背景样式

$(".snav ul li a").hover(function (){
$(this).parent().addClass("snav ");
$(this).parent().siblings().removeClass("snav ");
$(this).parent().siblings().addClass("snavcheck");
});

这两个样式我只是举例的 至于具体的样式你自己去弄吧 我大概把逻辑写出来了本回答被提问者采纳
相似回答