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

后端 未结 21 2139
清歌不尽
清歌不尽 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条回答
  •  心在旅途
    2020-11-22 09:32

    I'm a bit behind the times on answering this, but I found a way to do it :)

    function eventinfo(id) {
        tr = document.getElementById("ei"+id);
        div = document.getElementById("d"+id);
        if (tr.style.display == "none") {
            tr.style.display="table-row";
            $(div).slideDown('fast');
        } else {
            $(div).slideUp('fast');
            setTimeout(function(){tr.style.display="none";}, 200);
        }
    }
    

    I just put a div element inside the table data tags. when it is set visible, as the div expands, the whole row comes down. then tell it to fade back up (then timeout so you see the effect) before hiding the table row again :)

    Hope this helps someone!

提交回复
热议问题