Add id=top to body and add auto scroll when details block is closed
This commit is contained in:
6
app.js
6
app.js
@@ -1,10 +1,14 @@
|
|||||||
// Set expanded value block to a variable
|
// Set expanded value block to a variable
|
||||||
const valueBlock = document.getElementById("value-expanded");
|
const valueBlock = document.getElementById("value-expanded");
|
||||||
|
const bodyTop = document.getElementById("top");
|
||||||
|
|
||||||
// Watch for the details element to be toggled
|
// Watch for the details element to be toggled
|
||||||
document.querySelector('.value-block').addEventListener('toggle', function() {
|
document.querySelector('.value-block').addEventListener('toggle', function() {
|
||||||
if (this.open) {
|
if (this.open) {
|
||||||
// Scroll to contents of value block when it is opened
|
// Scroll to contents of value block when it is opened
|
||||||
valueBlock.scrollIntoView({ behavior: "smooth" });
|
valueBlock.scrollIntoView({ behavior: "smooth" });
|
||||||
}
|
} else {
|
||||||
|
// Scroll to top of button list when value block is closed
|
||||||
|
bodyTop.scrollIntoView({ behavior: "smooth" });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
<!-- End Open Graph Tags -->
|
<!-- End Open Graph Tags -->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body itemtype="https://schema.org/ProfilePage" itemscope>
|
<body id="top" itemtype="https://schema.org/ProfilePage" itemscope>
|
||||||
<meta itemprop="dateModified" content="2025-07-24T16:00:00-05:00" />
|
<meta itemprop="dateModified" content="2025-07-24T16:00:00-05:00" />
|
||||||
|
|
||||||
<div class="container" itemprop="mainEntity" itemtype="https://schema.org/Person" itemscope>
|
<div class="container" itemprop="mainEntity" itemtype="https://schema.org/Person" itemscope>
|
||||||
|
Reference in New Issue
Block a user