Replace jquery.is (: hover) pseudo-element

I am using the following piece of code in my page ...

if ( $("#footer, #header").is(':visible') && && !$("#footer, #header").is(':hover') ) { 

      

I have updated to the latest version of jQuery and now this one is .is(:hover)

no longer supported.

How do I do it in my code above. I've already googled and found several threads regarding this problem, but couldn't find a suitable solution for my code above.

I am using this code to handle the event timeout

. If my mouse is over the header or footer, I don't want the timeout to be cleared.

+3


source to share


1 answer


You can add a class to the hover event for elements and then check if the class exists.

Switch class to hover:

$("#footer, #header").hover(function() {
    $(this).toggleClass('hover');
});

      



Check class:

if (!$("#footer, #header").hasClass('hover')) { 
     //do  your stuff
});

      

+1


source







All Articles