How to remove .css("background","red"); from (A.yuimenubaritemlabel.sub) element after unhovering .yuimenuitemlabel element ?
$(document).ready(function(){
$(".yuimenuitemlabel").mouseover(function(){
$("A.yuimenubaritemlabel.sub").css("background","red");
});
});
You need to reset the css property on mouse leave.
$(".yuimenuitemlabel").mouseover(function(){
$("A.yuimenubaritemlabel.sub").css("background","red");
}).mouseleave(function(){
$("A.yuimenubaritemlabel.sub").css("background","");
});
Use hover function if you have do do many things you can use hover.
$(".yuimenuitemlabel").hover(function(){
$("A.yuimenubaritemlabel.sub").css("background","red");
}, function(){
$("A.yuimenubaritemlabel.sub").css("background","");
});
Use hover function assuming you just need to change the css. You can make two class one is sub and other is newsub.
$(".yuimenuitemlabel").hover(function(){
$("A.yuimenubaritemlabel.sub").toggleClass("newsub");
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With