使用动画向上/向下滑动表格

时间:2012-08-07 11:59:54

标签: javascript jquery animation

我想用动画关闭/打开一个表。为此尝试使用jQuery只是为了发现jquery无法对表执行slideUp / Down。 当然我可以使用.wrap()将该表封装在div中,但它很笨拙,有时会给我带来错误

还有其他选择吗? 另外,jquery动画并不流畅;如何在http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm

中实现流畅的动画效果

1 个答案:

答案 0 :(得分:0)

jsFiddle EXAMPLE

<button id="hidr">Hide</button>
<button id="showr">Show</button>

<table border="1">
  <tr>
    <td>row 1, cell 1</td>
    <td>row 1, cell 2</td>
  </tr>
  <tr>
    <td>row 2, cell 1</td>
    <td>row 2, cell 2</td>
  </tr>
</table>

<script>
    $("#hidr").click(function () {
      $("table").hide("fast");
    });
    $("#showr").click(function () {
      $("table").show("fast");
    });
</script>
相关问题