简体   繁体   English

切换div $ this而不切换同一个类的另一个

[英]Toggle div $this without toggling another with same class

How would I toggle this divs .pane-content without toggling another with same class? 我如何切换这个divs .pane-content而不切换同一个类的另一个?

HTML: HTML:

<div class="pane">
   <div class="pane-header">Settings
  <div class="pane-controls">
        <span class="pane-toggle"><i class="fa fa-chevron-up"></i></span>
     <i class="fa fa-times"></i>
  </div>
  <div style="clear:both;"></div>
   </div>
   <div class="pane-content">
         Loreum Ipsum
   </div>
</div>

JS: JS:

$('.pane-toggle').click(function () {
    $('.pane-content').toggle('fast');
    $("i", this).toggleClass("fa-chevron-down fa-chevron-up");
});

Try - 尝试-

$('.pane-content',$(this).closest('.pane')).toggle('fast');

Demo -----> http://jsfiddle.net/t5kM7/1/ 演示-----> http://jsfiddle.net/t5kM7/1/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM