3

I'm summarizing my key problem here.

I've the different links on which I want to check if the user moves the mouse outside the list or not.

$('li').hover(function(){
    //do something here
},function(){
    setTimeout(function(){
            if($('li').is(':hover') === false )
            console.log('out');
        },100);
});

Where, if($('li').is(':hover') === false ) is to check if the hover is there or not in all lists.

Suppose, if you hover on bar and hover on foo then it should not log the text out but if you hover on bar and move mouse outside any list i.e. foo in my example then it should log out

jsfiddle

3
  • That error message looks like $('li') returns empty list. Did you have any 'li' elements in your DOM? Commented Jan 26, 2015 at 21:19
  • Did you check the jsfiddle in my question? Commented Jan 26, 2015 at 21:22
  • Oops, sorry, didn't spot it earlier... So, I've looked there and I don't know what's the cause of the error. :( Commented Jan 27, 2015 at 21:36

1 Answer 1

7

I'm not sure why you are getting that error but you could use this if statement instead to check for hover.

if ($('li:hover').length === 0)
Sign up to request clarification or add additional context in comments.

1 Comment

jQuery's selector engine Sizzle does not seem to support pseudo selector :hover and will raise above mentioned error "unsupported pseudo".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.