jQuery slideToggle doesn't work with colspan in Firefox?

一世执手 提交于 2019-12-12 15:11:58

问题


<script type="text/javascript">
$(document).ready(function() {


    $('#description').show();
    $('#extender').click(function() {
    $('#description').slideToggle("fast");

    });

});  
</script>

 <tr>
    <td>cell1</td>
    <td><a href="#" id="extender">link</a></td>
  </tr>
  <tr id="description">
    <td colspan="2" class="desc">This should span two columns but it doesnt bla jaajja</td>
  </tr>
  <tr>
    <td>cell1</td>
    <td>cell2</td>
  </tr>

回答1:


There might be a problem might with animating table element. Workaround for this is to put TD's body into a DIV, and animate a DIV.

In my code I use something like this:

       var el = $("TR.post_"+_id+' TD');
       el.wrapInner("<div/>");
       $("TR.post_"+_id+' TD DIV').slideUp('500');
       setTimeout(function(){el.remove()},500);


来源:https://stackoverflow.com/questions/1269220/jquery-slidetoggle-doesnt-work-with-colspan-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!