Recently, I switched to Angular material for the website I was working on, with a navigation bar (now a toolbar) with buttons that, when clicked, highlight sections on the page.
Now, so that the toolbar shrinks and reappears when scrolling up, I had to put the contents of the page into the component of the md-content component after the toolbar, but it broke all the binding functionality ...
I canβt find a fix for this, they only work when the scrollable element is the body, but with the fact that I lose the shrink effect, the ripple effect and even get a weird kind of sidenav ...
Relevant Code:
CSS
body{ overflow-y: hidden; } #main-content{ height: 100vh; }
HTML:
<md-toolbar md-scroll-shrink> (...) <md-button href="#leave-email">Click</md-button> </md-toolbar> <md-content id="main-content"> (...) <md-button href="#leave-email">Click</md-button> (lot of stuff) <section id="leave-email">(...)</section> </md-content>
None of the above buttons work, previously I used Angular smooth scrolling to smoothly scroll, but I deleted it when I tried to enable this.
html css anchor angular-material
Vitor mota
source share