I get the following error:
Uncaught TypeError: Cannot read property 'top' of undefined
$(document).ready(function() {
$(function() {
$('a[href*="#"]').on('click', function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top
}, 500, 'linear');
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="scrollDown">
<a href="#nextSection"><span></span>toliau</a>
</div>
#nextSectionelement doesn't exist, henceoffset()is undefined, and trying to access a property of an undefined object gets you the error you're seeing.