2012-05-07 6 views
0

ここで私のチェックボックスのslideDownソリューションの例があります。 http://jsfiddle.net/kNpYz/3/jQuery slideDown for 2 html case

チェックボックスをオンにすると、いくつかの要素がslideDownまたはslideUPになり、正常に動作しますが、これでHTMLを変更すると、私はjQueryのマークアップを変更する必要があることを知っていますが、私は方法がわかりません。

<div id="section-uvitaci_text" class="section section-checkbox ibutton"> 
    <h3 class="heading">Uvítací text</h3> 
    <div class="option"> 
    <div class="controls"> 
     <input type="hidden" class="fld checkbox aq-input" name="uvitaci_text" id="uvitaci_text" value="0"> 
     <div class="ibutton-container"> 
     <input type="checkbox" class="fld checkbox of-input" name="uvitaci_text" id="uvitaci_text" value="1" checked="checked"> 
     <div class="ibutton-handle" style="left: 50px; "> 
      <div class="ibutton-handle-right"> 
      <div class="ibutton-handle-middle"></div> 
      </div> 
     </div> 
     <div class="ibutton-label-off"><span style="margin-right: -50px; "> 
      <label>OFF</label> 
      </span></div> 
     <div class="ibutton-label-on" style="width: 54px; overflow-x: hidden; overflow-y: hidden; "><span style="margin-left: 0px; "> 
      <label>ON</label> 
      </span></div> 
     <div class="ibutton-padding-left"></div> 
     <div class="ibutton-padding-right"></div> 
     </div> 
    </div> 
    <div class="explain">This will show an offline message. Except for administrators, nobody will be able to access the site</div> 
    <div class="clear"> </div> 
    </div> 
</div> 

効果は働きません。私はこのHTMLのケースで私のjsを変更する必要がありますか?お時間を

Thxを

答えて

0

使用このjQueryのコード:

jQuery('.fld').click(function() { 
    $(this).closest('.option').find('.explain').slideToggle('normal', "swing"); 
    }); 
+0

HTMLは、このプラグインによって生成されるhttp://www.givainc.com/labs/ibutton_jquery_plugin.htm あなたのコードのためのthx: – user13746

+0

@ user13746もしそれが自動生成されたhtmlなら、編集されたjqueryコード –

+0

を使用して、こう書くことができますか?ここで .find(+ this.id '_ F') – user13746

0

あなたのHTMLが同じIDを持つ2つのコントロールもカント、あなたはjqueryのでスライドIDが存在しない、してみてくださいのような多くのエラーを持っていますこの:

Correct code

関連する問題