ani_css
ani_css

Reputation: 2126

How to hide bootstrap modal in wide screen

I will make open bootstrap modal in mobile but I won't close it clicking by any button except if I resize resolution bigger than mobile version I want close to it

I have no any code and any idea how to possible ?

Upvotes: 0

Views: 198

Answers (2)

Luuk Skeur
Luuk Skeur

Reputation: 1940

Option 1: Give the modal the following class(es): hidden-md hidden-lg.

Option 2: Use jQuery:

$(window).resize(function() {
  if($(window).width < 968 /* or any other width */){
    $('#mymodal').modal('hide');
  }
});

Upvotes: 2

Văn Tuấn Phạm
Văn Tuấn Phạm

Reputation: 659

You Try code:

if(screen.width < YourWidth){
   $('#modal').modal('hide');
 }

Upvotes: 2

Related Questions