Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How To Add Sticky Navigation in Magento 2 Theme

Sticky navigation with animation in down effect.

 

Step 1 : Open your "header.phtml" file.

Step 2 : Copy below javascript code and past header.phtml file in bottom.

 

Step 3 : Copy below CSS and paste in css file.

 .fixed-header.page-wrapper .nav-sections{position:fixed;z-index:9;top:0;width:100%;margin-top:0;animation:nav-down .7s;}  
@keyframes nav-down {
0%{transform:translateY(-100%)}
100%{transform:translateY(0)}
}

Step 4 : Please clean cache : php bin/magento cache:clean

Now refresh your browser and scroll down.

Info
: This example use only in magento project if you want other project use please change class name.


This post first appeared on Smita-tech, please read the originial post: here

Share the post

How To Add Sticky Navigation in Magento 2 Theme

×

Subscribe to Smita-tech

Get updates delivered right to your inbox!

Thank you for your subscription

×