Scroll page sections with navigation links

wp nav menu1

If you want to create single page website or any section want to scroll on a click of anchor tag. You have to no worry just read this code and put on your html code.

Site nav links
    <a href="#home">Home</a> 
    <a href="#about">About</a>
    <a href="#contact">Contact</a>
Site page sections
<div id="home">This is Home page section</div>
<div id="about">This is About page section</div>
<div id="contact">This is Contact page section</div>
Add JavaScript for onclick nav anchors to scroll sections
$("nav").find("a").click(function(e) {
    var page_section = $(this).attr("href");
    $("html, body").animate({
        scrollTop: $(page_section).offset().top

Leave a Reply