My onepage website features menu points that smoothly scroll to a specific div upon click. Although the functionality is working correctly, I have added a jQuery function for animation which seems to be malfunctioning.
Below is the HTML code:
<div class="mainmenu">
<div class="menuwrapper">
<div class="menulist">
<ul class="items">
<li class="menuitem">
<a href="#home">HOME</a>
</li>
<li class="menuitem">
<a href="#team">TEAM</a>
</li>
<li class="menuitem">
<a href="#leistungen">LEISTUNGEN</a>
</li>
<li class="menuitem">
<a href="#know-how">KNOW-HOW</a>
</li>
<li class="menuitem">
<a href="#contact">KONTAKT</a>
</li>
</ul>
</div>
</div>
</div>
and this is the JavaScript code snippet:
$(document).ready(function(){
$('a').click(function(){
$('html, body').animate({
scrollTop: $('[name="' + $.attr(this, 'href').substr(1) + '"]').offset().top
}, 500, "swing");
return false;
});
$(window).resize(function(){
sliderResize();
});
});
If anyone has any insights or suggestions, please feel free to share them!