Prevent <amp-sidebar> from returning to the top of the page
I'm trying to create a simple replacement for my previous hamburger menu, which has some navigation links that just scroll through the page view in the specified section with href="#section".
Since I can no longer use the Checkbox trick, I had to use <amp-sidebar>for it:
<amp-sidebar id="sidebar" layout="nodisplay" side="right">
<ul>
<li>
<a href="#secion1">Section 1</a>
</li>
<li>
<a href="#secion2">Section 2</a>
</li>
<li>
<a href="#secion3">Section 3</a>
</li>
</ul>
</amp-sidebar>
The problem is that every time the sidebar closes, the page returns to the top position (even the URL returns to its original state, therefore it #sectionis deleted).
Is there a way to prevent this behavior?
+4
1 answer