Files
littlelink/app.js

15 lines
545 B
JavaScript
Raw Normal View History

2025-07-24 11:33:38 -04:00
// Set expanded value block to a variable
const valueBlock = document.getElementById("value-expanded");
const bodyTop = document.getElementById("top");
2025-07-24 11:33:38 -04:00
// Watch for the details element to be toggled
document.querySelector('.value-block').addEventListener('toggle', function() {
if (this.open) {
2025-07-24 11:33:38 -04:00
// Scroll to contents of value block when it is opened
valueBlock.scrollIntoView({ behavior: "smooth" });
} else {
// Scroll to top of button list when value block is closed
bodyTop.scrollIntoView({ behavior: "smooth" });
}
});