jquery对面的$(这个)

Jos*_*shc 4 jquery

是否有可能执行相反的操作$(this)

因此,不是gettin this元素,它得到一切匹配.sb-popular-thumb a但排除$(this)

请参阅下面的示例代码.我已标记$(this),$(reverse)所以你可以看到我想要实现的目标.

$('.sb-popular-thumb a').hover(
  function () {

    $('.sb-popular').stop().animate({
        height : '168px'                    
    }, 200);

    $(this).siblings('.sb-popular-thumb-title').show();

    $(reverse).siblings('.sb-popular-thumb-overlay').stop().fadeIn(200);

  },
  function () {

    $('.sb-popular').stop().animate({
        height : '140px'                    
    }, 200);

    $(this).siblings('.sb-popular-thumb-title').hide();

    $(reverse).siblings('.sb-popular-thumb-overlay').stop().fadeOut(200);

});
Run Code Online (Sandbox Code Playgroud)

ade*_*neo 8

只需使用:

$('.sb-popular-thumb a').not(this)
                        .siblings('.sb-popular-thumb-overlay')
                        .stop()
                        .fadeIn(200);
Run Code Online (Sandbox Code Playgroud)

<a>除了之外,它将获得该类中的所有元素this.

siblings() 会做几乎一样的,但只会得到兄弟元素(duh)?