We can animate a navbar using affix by using css style in the affix
<style> .affix { top: 0; width: 100%; -webkit-transition: all .5s ease-in-out; transition: all .5s ease-in-out; border: 2px solid black; background-color: orange; } .affix a { color: black !important; padding: 10px; -webkit-transition: all .5s ease-in-out; transition: all .5s ease-in-out; } .affix-top a { padding: 25px !important; } .affix + .container-fluid { padding-top: 200px; } </style> </head> <body> <div class="container-fluid" style="color:white;background-color:green;height:200px;"> <h2>SN ITFunda</h2> <p> SN ITFunda is a software company which have websites of dotnetfunda, techfunda, itfunda for making people learning .net technologies SN ITFunda is a software company which have websites of dotnetfunda, techfunda, itfunda for making people learning .net technologies SN ITFunda is a software company which have websites of dotnetfunda, techfunda, itfunda for making people learning .net technologies SN ITFunda is a software company which have websites of dotnetfunda, techfunda, itfunda for making people learning .net technologies SN ITFunda is a software company which have websites of dotnetfunda, techfunda, itfunda for making people learning .net technologies SN ITFunda is a software company which have websites of dotnetfunda, techfunda, itfunda for making people learning .net technologies SN ITFunda is a software company which have websites of dotnetfunda, techfunda, itfunda for making people learning .net technologies </p> </div> <nav class="navbar navbar-inverse" data-spy="affix" data-offset-top="200"> <ul class="nav navbar-nav"> <li><a href="#">DotNetFunda</a></li> <li><a href="#">TechFunda</a></li> <li><a href="#">ITFunda</a></li> </ul> </nav> <div class="container-fluid" style="color:black;background-color:pink; height:800px;"> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> <h2>SN ITFunda</h2> </div> </body>
container-fluid
with given style to define the valuenavbar navbar-inverse
and data-spy as affix
, data-offset-top value as 200
. nav navbar-nav
to define the list value container-fluid
with style output
Views: 10041 | Post Order: 65