Skip to content Skip to sidebar Skip to footer

Sticky Navigation With Submenu And Smooth Scroll

Im a beginner in hmtl css jquery js.. I have a navigation that is sticky but can not add sub menu to navigation, also if sub menu is created i want the navigation to stay sticky. I

Solution 1:

You can try below code:

$(document).scroll(function() {
    if ($(this).scrollTop() > 150) {
        $('.navbar').css('position','fixed');
        $('.navbar').css('top','0');
    } 
    else {
        $('.navbar').css('position','static');
    }
});

Here in above code 150 is dummy value you can try a number as per your requirement.

OR

Try this link : http://www.backslash.gr/demos/jquery-sticky-navigation/

Solution 2:

example

<li><ahref="#">Menu 2</a><ul><li><ahref="#">Sub Menu 1</a></li><li><ahref="#">Sub Menu 2</a></li><li><ahref="#">Sub Menu 3</a></li></ul>

Post a Comment for "Sticky Navigation With Submenu And Smooth Scroll"