Ich mache eine Test-Website, wo die Verwendung klickt ein Ankerelement, das sie zum nächsten Abschnitt der Seite führt. Ich kann nicht herausfinden, warum ich meine Animation nicht zeige, wenn der Benutzer auf den Anker klickt.Scroll-Animation funktioniert nicht
$(function() {
$('a[href*=#]').on('click', function(e) {
e.preventDefault();
$('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top}, 2000);
});
});
<head>
<link href="https://fonts.googleapis.com/css?family=Rokkitt" rel="stylesheet">
</head>
<body>
<header>
<h1 id="section00" class="siteName selector">Travel More</h1>
<h2 class="downPage"><a href="#section01" class="down1">∨</a></h2>
</header>
<section id="section01" class="content selector"><a href="#section02" class="down1">Second</a></section>
<section id="section02" class="content selector">
<a class="down1" href="#section03">Third</a>
</section>
<section id="section03" class="content selector">
<a class="down1" href="#section00">Last</a>
</section>
<footer><p>Travel More 2016</p></footer>
</body>
This is a link to the code (codepen)
Sie HTML zur Verfügung stellen kann? – osmanraifgunes