Faustino Luna Montaner Faustino Luna Montaner - 1 year ago 118
Javascript Question

How to open programatically bootstrap mobile navbar?

I'm trying to discover the way to open the bootstrap mobile navbar when a button is clicked.

// Magic code goes here!

No matters is I need to use jQuery.

Answer Source

The responsive navbar uses the collapse plugin, you can use a link with the href attribute, or a button with the data-target attribute of the button in your navbar. Here's an example


If you want to do it via jQuery you can call the collapse methods: .collapse('toggle'), .collapse('show') or .collapse('hide')

I updated the example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download