diff --git a/app.js b/app.js index 77871be..b27fde8 100644 --- a/app.js +++ b/app.js @@ -1,8 +1,10 @@ +// 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) { - // Code to execute when the details are opened + // Scroll to contents of value block when it is opened valueBlock.scrollIntoView({ behavior: "smooth" }); } });