Prev Demo
Bootstrap
>
Affix Navbar
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <style> .affix { top: 0; width: 100%; } .affix + .container-fluid { padding-top: 70px; } </style> </head> <body> <header class="container-fluid" style="background-color:red;color:white;height:200px;"> <h1>Bootstrap Affix Example</h1> <p>SN ITFunda is a online tutorial which consists of websites to make people learn web technologies with the websites dotnetfunda, techfunda, itfunda, farmingfunda, funddo video etc </p> </header> <nav class="navbar navbar-inverse"> <ul class="nav navbar-nav"> <li class="active"><a href="#">SN ITFunda</a></li> <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="height:900px;background-color:pink;color:black;"> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> <h1>SN ITFunda</h1> </div> <script> $(document).ready(function () { $(".navbar").affix({ offset: { top: $("header").outerHeight(true) } }); }); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output