How to Use slideDown (or show) function on a table row?

后端 未结 21 2737
清歌不尽
清歌不尽 2020-11-22 09:03

I\'m trying to add a row to a table and have that row slide into view, however the slidedown function seems to be adding a display:block style to the table row which messes

21条回答
  •  猫巷女王i
    2020-11-22 09:52

    function hideTr(tr) {
      tr.find('td').wrapInner('
    ').parent().find('td > div').slideUp(50, function () { tr.hide(); var $set = jQuery(this); $set.replaceWith($set.contents()); }); } function showTr(tr) { tr.show() tr.find('td').wrapInner('
    ').parent().find('td > div').slideDown(50, function() { var $set = jQuery(this); $set.replaceWith($set.contents()); }); }

    you can use these methods like:

    jQuery("[data-toggle-tr-trigger]").click(function() {
      var $tr = jQuery(this).parents(trClass).nextUntil(trClass);
      if($tr.is(':hidden')) {
        showTr($tr);
      } else {
        hideTr($tr);
      }
    });
    

提交回复
热议问题