modifying css with jquery

I have a ul list and below im using jquery to find out if the user is hovering sub menus under about us and if yes set some css on hover. This does change the background color to green but when i hover off the green doesnt go away?

JQUERY

$('ul > li > ul > li a').hover(
    function(){
        var whatami = $(this).parents('li').eq(1).find('a[title]:first').attr('title');
        console.log(whatami);
        if (whatami == 'About Us') {
            //alert(whatami);
            $('.white ul.mega-menu li .sub-container.non-mega li a:hover').css({"background-color":"green"});

        }
    },
    function(){
    });

Answers


in jQuery the :hover is just an element selector, it's not the same as CSS a:hover. Trying something like:

$('.white ul.mega-menu li .sub-container.non-mega li a').hover(
    function () {
        $(this).css({"background-color":"green"});
    },
    function () {
        $(this).css({"background-color":"none"});
    }
); ‚Äč

The way hover works is that the first function is executed when the mouse enters and the 2nd is executed when the mouse leaves. You have nothing in the 2nd function, so that means nothing will happen when the mouse leaves. You need to do whatever you want to do in the 2nd function:

$('ul > li > ul > li a').hover(
function(){
    // make it green
},
function(){
    // CHANGE IT BACK HERE
});

Need Your Help

Exploded jar in war libs

java jboss

Can we put exploded jar files in war web-inf libs ? Its not working for me in JBOSS 4.2. I got following error and not able to deploy the application:

Detecting Vista IE7 Protected Mode with Javascript

javascript windows-vista internet-explorer-7 protected mode

I'd like to be able to detect Vista IE7 Protected Mode within a page using javascript, preferably. My thinking is to perform an action that would violate protected mode, thus exposing it. The goal ...

is there a difference in the way the icons are referenced in build and installer versions?

c# visual-studio-2008 installer

is there a difference in the way the icons are referenced in build and installed version ?