Fix hash anchors scroll

This commit is contained in:
Dominik Korsa 2021-09-03 19:48:57 +02:00
parent 4da6ff8a0e
commit bb848e2e00
No known key found for this signature in database
GPG key ID: 9F6F7E66CBF4C1D9
4 changed files with 8 additions and 3 deletions

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="contact home-section"> <div id="contact" class="contact home-section">
<h2 class="contact__title">Kontakt</h2> <h2 class="contact__title">Kontakt</h2>
<form class="contact__form" action="https://formspree.io/xdonynaz" method="POST"> <form class="contact__form" action="https://formspree.io/xdonynaz" method="POST">
<label for="contact__form-email" class="contact__form-label">Twój adres email:</label> <label for="contact__form-email" class="contact__form-label">Twój adres email:</label>

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="features-table-section home-section"> <div id="features-table" class="features-table-section home-section">
<h2 class="features-table-section__title">Porównanie funkcji</h2> <h2 class="features-table-section__title">Porównanie funkcji</h2>
<div class="features-table"> <div class="features-table">
<table class="features-table__table"> <table class="features-table__table">

View file

@ -1,5 +1,5 @@
<template> <template>
<div class="main home-section"> <div id="main" class="main home-section">
<home-main-header /> <home-main-header />
</div> </div>
</template> </template>

View file

@ -6,5 +6,10 @@ Vue.use(Router);
export default new Router({ export default new Router({
mode: 'history', mode: 'history',
scrollBehavior(to, from, savedPosition) {
if (to.hash) return { selector: to.hash };
if (savedPosition) return savedPosition;
return null;
},
routes, routes,
}); });