Added anchors to first row and swishy animation

This commit is contained in:
giuliof 2020-12-08 18:26:02 +01:00
parent b59b5e5b00
commit e15727ae21
3 changed files with 26 additions and 1 deletions

13
animations.js Normal file
View File

@ -0,0 +1,13 @@
// Automagically nimate clicks to anchors
function animations() {
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
}

View File

@ -13,8 +13,9 @@
<script type="text/javascript" src="lug.js"></script>
<script type="text/javascript" src="counters.js"></script>
<script type="text/javascript" src="animations.js"></script>
</head>
<body onload="lugtoscana(); counters();">
<body onload="lugtoscana(); counters(); animations();">
<header>
<h1 class="golem_font" >GOLEM</h1>
@ -24,12 +25,15 @@
<main>
<section id="chisiamo" class="bg">
<h2>Chi siamo</h2>
<a href="#attivita" class="anchor">
<div>
<h3>Il GOLEM</h3>
<p>
«Gruppo Operativo Linux Empoli» è il Linux Users Group di Empoli, ed è un'associazione di promozione sociale.
</p>
</div>
</a>
<a href="#" class="anchor">
<div>
<h3>Dove siamo</h3>
<p>
@ -37,12 +41,15 @@
</p>
<p><a href="https://www.openstreetmap.org/?mlat=43.72634&mlon=10.92510#map=18/43.72634/10.92510">Mappa</a></p>
</div>
</a>
<a href="#news" class="anchor">
<div>
<h3>Quando</h3>
<p>
Martedì sera<br/>dalle 21.30 alle 24.00
</p>
</div>
</a>
</section>
<section id="news" class="bg">

View File

@ -161,3 +161,8 @@ ul > li {
.golem_font {
font-family: GOLEM, comfortaa, "Arial", sans-serif;
}
a:link.anchor, a:visited.anchor {
color: inherit;
text-decoration: inherit;
}