English 中文(简体)
除被点击外,如何 every取每一支 j子?
原标题:How to toggle every jQuery element except the clicked?

因此,我试图在 j中找到似乎非常基本的东西。 我有一些“头盔”,当我点击一位头目时,我想要把头脑背后的胎儿 be落下来,而所有其他头脑则 in倒(因此,当时只有一位头脑显示胎儿衰败)。

这里,我要说的是:

$( .more-info-header:not(.jquery-processed) ).addClass( jquery-processed ).click(function(e) {
  $(this).children( .game-info-text ).slideToggle("Slow");
  [all other ( .game-info-text )].slideUp(fast)
});

不过,对于我来说,我可以说明如何将第二行([所有其他(加梅-英文本)]编码。 任何帮助都受到高度赞赏!

(如果将这种做法作为累rup行为加以实施,这就是为什么我增加了“杂乱处理”类。)

最佳回答

类似:

$( .more-info-header:not(.jquery-processed) ).addClass( jquery-processed ).click(function(e) {
  $(this).children( .game-info-text ).slideToggle("Slow");
  $( .more-info-header ).not(this).children( .game-info-text ).slideUp(fast);
  //                      ^-- removes the clicked element from all `.more-info-header`
});

参考:.not()

问题回答

http://jqueryui.com/demos/accordion/“rel=“nofollow noreferer” Query UI Agreemention plugin.

$( .more-info-header:not(.jquery-processed) )
.addClass( jquery-processed ).click( function(e) {
  var these = $(this).children( .game-info-text ).slideToggle("slow");
  $( .game-info-text ).not(these).slideUp("fast");
});

not(>, 您可以排除已经选定的内容。

与此类似:

  $( .more-info-header ).click(function(e){
    var target = e.target || e.srcElement;
   $(this).children().not(target).find( .game-info-text ).slideUp( fast );
   $( .game-info-text , target).slideToggle("slow");
  });




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签