Jquery 将.not()和parents()组合在一起

Jquery 将.not()和parents()组合在一起,jquery,Jquery,这很有效。现在,我想阻止当一个祖先具有无值属性“nopopp”时.hover()的操作,正如上面的b所做的那样。即使$selector选择了c和d,该“nopoup”也会阻止它们的任何悬停。悬停候选和被阻止的NOPOPP之间的级别数不同 我需要像这样的东西: $($selector).hover( // popup the menu ) 括号里是什么?或者这是错误的方法?ID不能重复使用,请注意更改 $($selector).not( one of the selected node's

这很有效。现在,我想阻止当一个祖先
具有无值属性“nopopp”时.hover()的操作,正如上面的
b所做的那样。即使$selector选择了c和d,该“nopoup”也会阻止它们的任何悬停。悬停候选和被阻止的NOPOPP之间的级别数不同

我需要像这样的东西:

$($selector).hover( 
  // popup the menu
)

括号里是什么?或者这是错误的方法?

ID不能重复使用,请注意更改

$($selector).not( one of the selected node's parents has the attribute "nopopup" ).hover( 
  // popup the menu
)

可以使用几种方法。下面假设
nopopp
是一个类,因为html无效

​$('.d').not('div[nopopup] .d').hover(function(){
    //logic 
});​​​​​​​​​​​​​​​​​​


没有属性nopoup,将其用作一个类:
$(选择器).filter(函数(){return!$(this).closest('.nopoup').length;}).hover(…
此项目无畏无耻地使用自定义属性。时间会告诉我…closest()是我所需要的。+1,Q回答。
​$('.d').not('div[nopopup] .d').hover(function(){
    //logic 
});​​​​​​​​​​​​​​​​​​
$($selector).hover( 
  if( !$(this).closest('.nopopup').length){
       /* run code when nopop isn't ancestor*/
   }
)
$($selector).not('.nopopup '+$selector).hover(....