11 lines
372 B
JavaScript
11 lines
372 B
JavaScript
// Set expanded value block to a variable
|
|
const valueBlock = document.getElementById("value-expanded");
|
|
|
|
// Watch for the details element to be toggled
|
|
document.querySelector('.value-block').addEventListener('toggle', function() {
|
|
if (this.open) {
|
|
// Scroll to contents of value block when it is opened
|
|
valueBlock.scrollIntoView({ behavior: "smooth" });
|
|
}
|
|
});
|