Jquery how to test if current hovered div is eq(x)

Posted by j-man86 on Stack Overflow See other posts from Stack Overflow or by j-man86
Published on 2010-05-05T03:39:47Z Indexed on 2010/05/05 3:48 UTC
Read the original article Hit count: 218

Filed under:
|

Hi all!

I am trying to create a jQuery hover function that will highlight a different section of the page depending on what number EQ (index position number) the div is.

    $('#photoContent div').hoverIntent(function () {    
        if( $(this).filter(':lt(5)') ) {
            $('#photoSidebar').find('p:eq(0)').addClass('currentPhoto');
        }

        if( $(this).filter(':gt(5)') ) {
            $('#photoSidebar').find('p:eq(1)').addClass('currentPhoto');
        }
    }, function () {
        $('#photoSidebar').find('p').removeClass('currentPhoto');
    });

The above code obviously does not work, but the concept/functionality is what I'm going for. Thanks for your help!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about hover