fingers10 / BlazorParallax

Simple parallax page with blazor
8 stars 2 forks source link

Anchor tags #1

Closed SQL-MisterMagoo closed 4 years ago

SQL-MisterMagoo commented 4 years ago

You might not know , but you can use target="_top" on your NavLinks to enable the browser to scroll for you - meaning you can remove all the javascript for scrollTo etc.

<NavLink class="nav-item nav-link" href="#page-hero" target="_top" Match="NavLinkMatch.All">home</NavLink>
fingers10 commented 4 years ago

will this work for all sections?

SQL-MisterMagoo commented 4 years ago

Yes, but there is a downside because some browsers support smooth scrolling - Firefox, some don't.

To try this, just add the target to your navlinks and remove the JavaScript

fingers10 commented 4 years ago

Hey I tried this. It works like charm. I'll update the code and add comments. So that the user who needs animation can use JavaScript and who don't need animation can proceed with your suggestion.

Thanks, Abdul Rahman