Maybe you should switch it to make use of the mouseover event only, and on mouseover change all menu items to off status and set the curret one to on?
$(".nav a img").mouseover(function() { // clear all menu items with _on img $(".nav a img").each(function(){ var src = $(this).attr("src"); if(src.indexOf("_on") != -1) { $(this).attr("src", src.replace("_on.png", ".png")); } }); // set current menu item to "on" var src = $(this).attr("src"); $(this).attr("src", src.replace(".png", "_on.png")); }); On Apr 11, 11:56 am, Takaya213 <nic...@njwebdesign.co.za> wrote: > Hi > > I have the following jQuery code, but it doesn't seem to work 100%: > $('.nav a img').hover( > function(){ > if($(this).attr("src").indexOf("_on") == -1) { > var newSrc = > $(this).attr("src").replace(".png","_on.png"); > $(this).attr("src",newSrc); > } > }, > function(){ > if($(this).attr("src").indexOf("_on.png") != -1) { > var oldSrc = > $(this).attr("src").replace("_on.png",".png"); > $(this).attr("src",oldSrc); > } > } > ); > > I am currently using it on the menu on my websitehttp://www.njwebdesign.co.za/ > > I want the selected/highlighted page to stay highlighted when it is hovered > over and not to be deselected. This is not currently working with the above > piece of code, if you have anything better or can help me fix the above, it > will be greatly appreciated. > > Thanks. :-(( > -- > View this message in > context:http://www.nabble.com/Menu-Hover-and-Selected-tp22999583s27240p229995... > Sent from the jQuery General Discussion mailing list archive at Nabble.com.