pxkw.hatenadiary.com

めもめも

trをslideToggleする

<div id="trSlideToggleSample">

  <table>
    <tr class="trTrigger">
      <th colspan="2">Click me to show.</th>
    </tr>
    <tr style="display:none">
      <th>Can you</th>
      <td>see me?</td>
    </tr>
  </table>

  <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
  <script>
    $(function(){
      $(".trTrigger").click( function() {
        $(this).next().slideToggle(125);
      });
    });
  </script>

</div>

Click me to show.
Can you see me?


うにょってなんね。

うにょってさせる

<div id="trSlideToggleSample2">

  <table>
    <tr class="trTrigger2">
      <th colspan="2">Click me to show.</th>
    </tr>
    <tr>
      <th><span style="display:none">Can you</span></th>
      <td><span style="display:none">see me?</span></td>
    </tr>
  </table>

  <script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
  <script>
    $(function(){
      $(".trTrigger2").click( function() {
        $(this).next().children("th").children("span").slideToggle(225);
        $(this).next().children("td").children("span").slideToggle(225);
      });
    });
  </script>

</div>

Click me to show.
Can you see me?


なんか変だ。

Remove all ads