That's ok, we all misunderstand things at sometime or other.

Unfortunatly this still removes the selected state of the button.

Maybe it is due to the way that i am giving the button its selected state.


victorg-2 wrote:
> 
> 
> Ah, guess i misunderstood.
> 
> A way to handle that could be to check what the current page is and
> highlight the menu item of the link who has a href to that page.
> And add an extra check to the mouseout function to only remove the _on
> suffix if its not the current page.
> 
> Would something like this work?
> 
> $('.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(){
>                       var activePage = window.location.pathname.substr(1);
>                       if($(this).parent().attr("href") != activePage) {
>                               if($(this).attr("src").indexOf("_on.png") != 
> -1) {
>                                               var oldSrc = 
> $(this).attr("src").replace("_on.png",".png");
>                                               $(this).attr("src",oldSrc);
>                               }
>                       }
>               }
> );
> 
> var activePage = window.location.pathname.substr(1);
> $("a[href="+activePage+"] img").trigger("mouseover");
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Menu-Hover-and-Selected-tp22999583s27240p23001350.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to