PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.8.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.8.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
ablocks / assets / build / blocks / table-of-content / view.js

view.js in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.8.0, at assets/build/blocks/table-of-content/view.js

1 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".ablocks-toc-item-link");if(e.forEach(t=>{t.addEventListener("click",function(t){t.preventDefault();const o=this.getAttribute("href").substring(1),c=document.getElementById(o);c&&(c.scrollIntoView({behavior:"smooth",block:"start"}),e.forEach(e=>e.classList.remove("active")),this.classList.add("active"))})}),e.length){const t=Array.from(e).map(e=>{const t=e.getAttribute("href")?.substring(1);return document.getElementById(t)}).filter(Boolean),o=new IntersectionObserver(t=>{t.forEach(t=>{if(t.isIntersecting){const o=t.target.id;e.forEach(e=>{e.classList.toggle("active",e.getAttribute("href")===`#${o}`)})}})},{rootMargin:"0px 0px -70% 0px",threshold:.1});t.forEach(e=>o.observe(e))}document.querySelectorAll(".ablocks-toc__header-toggle-icon").forEach(e=>{e.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();const o=e.closest(".ablocks-block").querySelector(".ablocks-toc-body");o&&(o.classList.contains("ablocks-toc__collapse")?(o.classList.remove("ablocks-toc__collapse"),e.querySelector(".ablocks-toc__show").style.display="flex",e.querySelector(".ablocks-toc__hide").style.display="none"):(o.classList.add("ablocks-toc__collapse"),e.querySelector(".ablocks-toc__show").style.display="none",e.querySelector(".ablocks-toc__hide").style.display="flex"))})})});