Change Image weird problem
Hi i have the following problem:
I have a navigation (ul) with buttons that change img src on mouseover / mouseout - this works fine so far.
this is the code:
- $('#navigation img')
.mouseover(function(){
var rsrc = jQuery(this).attr('src').replace('_on.png','_over.png');
jQuery(this).attr('src',rsrc);
})
.mouseout(function() {
var rsrc = jQuery(this).attr('src').replace('_over.png','_on.png');
jQuery(this).attr('src',rsrc);
});
In the navigation div is a li with the class "extcat", on rollover a submenu div "#extended_categories" pops down in which several links are. This works well so far too..
Now i want the navigation button to have another src img (kategorien_active.png) as long as i am in the #extended_categories div. Here's my code:
- $(".extcat").hover(function(){
$("#categories_extended").toggle();
});
$("#categories_extended")
.mouseover(function(){
$("#categories_extended").show();
$(".extcat img").attr('src').replace('_on.png','_active.png');
})
.mouseout(function(){
$("#categories_extended").hide();
$(".extcat img").attr('src').replace('_active.png','_on.png');
});
Everything works but the Button in the navigatio div to change img src.. any ideas ?
Thanks a lot !