Lou Franco
Lou Franco

Reputation: 89172

How do you make Bootstrap responsive on a phone but not a narrow desktop browser

I've found this page for turning off responsiveness in Bootstrap.

http://getbootstrap.com/examples/non-responsive/

What I'd like is to have one page that is responsive on the phone, but is not responsive when viewed on a desktop browser that has been resized to be narrow.

It looks like I could do most of what is on that page by detecting the device and then using JavaScript. Is there a simpler way that I'm missing or some other idea?

Upvotes: 0

Views: 67

Answers (1)

DivineChef
DivineChef

Reputation: 1221

Here's a way to force the mobile menu to toggle on a phone but you might have to worry about disabling other breakpoints. 480 represents the width of the smartphone, you can edit this as needed.

     $(window).resize(function() {
     if ($(window).width() <=480 ) {
      $('.navbar-collapse a').click(function(e) {

      $('.navbar-collapse').collapse('toggle');
     });
     }
     });

Upvotes: 1

Related Questions