1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| document.addEventListener("pjax:complete", tonav); document.addEventListener("DOMContentLoaded", tonav);
function tonav() { if (document.querySelector(".code-expand-btn")) { document .querySelector(".code-expand-btn") .addEventListener("click", function () { const table = this.nextElementSibling; const isExpanded = this.classList.contains("expand-done"); const tabBodyHeight = table.querySelector("tbody").offsetHeight; const mrHeight = "300px";
if (isExpanded) { table.style.maxHeight = mrHeight;
setTimeout(() => { table.style.maxHeight = tabBodyHeight + "px"; }, 1); } else { table.style.maxHeight = tabBodyHeight + "px";
setTimeout(() => { table.style.maxHeight = mrHeight; }, 1); } }); } }
|