martinezjc
martinezjc

Reputation: 3555

Bootstrap 3 set options for individual modal

I have the next piece of code trying to setup these properties for my bootstrap modal but when I place it into the $(document).ready the modal shows up when the page loads

$(document).ready(function(){
  $('#myModalBug').modal({
      backdrop: 'static',
      keyboard: false
  });
});

How can I make to set these properties without the dialog show up on load page?

Upvotes: 1

Views: 200

Answers (2)

Maulik Anand
Maulik Anand

Reputation: 1459

$(document).ready(function(){
  $('#myModalBug').modal({
      backdrop: 'static',
      keyboard: false,
      show:false
  });
});

You can also use data attributes like data-backdrop="static".

This way you don't need to write any of your script for modal unless you need explicitly for callbacks.

Upvotes: 1

Jared
Jared

Reputation: 2806

You need to set show to false. It defaults to true see the options here

  $(document).ready(function(){
  $('#myModalBug').modal({
      backdrop: 'static',
      keyboard: false,
      show: false
  });
});

Upvotes: 1

Related Questions