Skip to main content
All CollectionsWidgets and Advanced How-to's
How to open toggles by default
How to open toggles by default

Toggles are closed by default in Super. Here's a script to open the toggles on page load.

Cam Incoll avatar
Written by Cam Incoll
Updated over 2 years ago

Here is a script that will open Toggle blocks by default in Super.

Add this code to the Body section of global code or on the Body section of the page on which you wish this to run.

<script>
if(document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded',opentoggles);
}
else {
opentoggles();
}
function opentoggles() {
const detailsElements = document.querySelectorAll(".notion-toggle");
detailsElements.forEach(function(item) {
item.setAttribute("class", "notion-toggle open");;
});
}
</script>
Did this answer your question?