I am trying to make a menu that when you hover other menu item, there is a change from a white color to a tone of blue. I was thinking to use opacity, but had no luck, what would you suggest?
Try this fiddle: http://jsfiddle.net/fewds/mdamC/228/
试试这个小提琴:http://jsfiddle.net/fewds/mdamC/228/
#2
1
Since you are using css3, you may consider using a tranisition effect for the hover, e.g.:
由于你使用的是css3,你可以考虑使用tranisition效果来悬停,例如:
nav ul li a:hover{
-webkit-transition: background-color linear 1s;
-moz-transition: background-color linear 1s;
-ms-transition: background-color linear 1s;
transition: background-color linear 1s;
background-color: #43AEF2;
padding:15px;
color:white;
-moz-border-radius: 8px;
border-radius: 8px;
}
And after clicking the link:
点击链接后:
$('ul li a').on('click',function(){
$(this).parents('ul').find('li a').removeClass('current');
$(this).addClass('current');
});
JSFiddle
的jsfiddle
#3
0
i would go with @elclanrs suggestion but in your code wondering why you selecting the whole ul instead for each li element