Vaibhav Bhardwaj
Vaibhav Bhardwaj

Reputation: 199

Collapse navbar on load of page

I have added navbar button on top of my page. Problem is that when I load my page first time, navbar is expanded by default. Below is my code.

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-main" 
            aria-controls="navbar-collapse-main" aria-expanded="true" aria-label="toggle navigation">

<div class="collpase navbar-collapse" id="navbar-collapse-main">
// some content here
</div>

I need to keep navbar collapsed on load of page. I am using Bootstrap 3.x. Below is the page when I load it on mobile. I need to keep that top navbar collapsed initially and this should be expanded only when user clicks on three horizontal lines.

enter image description here

Upvotes: 3

Views: 1081

Answers (1)

Siddharth Bhansali
Siddharth Bhansali

Reputation: 2522

The navbar is supposed to be collapsed by default. The reason yours stays open is because you have a typo in your class name. Change collpase to collapse.

Upvotes: 1

Related Questions