jquery image swap works in one html file but not another

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2012-09-19T21:36:04Z Indexed on 2012/09/19 21:37 UTC
Read the original article Hit count: 148

Filed under:

I have two header templates for my site. One for the blog section and one for everything else. The below code swaps an image in my nav menu, on hover. It works for one template but not the other. The html code is pretty much identical in both header templates.

Please help me!!

 $(document).ready(function(){
        $('.nav-home, .nav-port, .nav-exp, .nav-cont, .nav-blog').hover(function(){
            $(this).attr('src','/images/' + $(this).attr('class') + '-hover.gif');
            }, function(){
            $(this).attr('src','/images/' + $(this).attr('class') + '.gif');
        }); 
    });

© Stack Overflow or respective owner

Related posts about jQuery