/* closing class */ details.closingsummary~* { animation: close .5s; }
在_partials/footer.njk 中最底端加入 <scripts> 标签包裹的如下内容:
1 2 3 4 5 6 7 8 9 10 11
const details = document.querySelector("details"); details.addEventListener("click", function(e) { if (details.hasAttribute("open")) { // since it's not closed yet, it's open! e.preventDefault(); // stop the default behavior, meaning - the hiding details.classList.add("closing"); // add a class which apply the animation in CSS setTimeout(() => { // only after the animation finishes, continue details.removeAttribute("open"); // close the element details.classList.remove("closing"); }, 400); } });
未找到相关的 Issues 进行评论
请联系 @KaiserWilheim 初始化创建