Bootstrap.js - how to automatically display a modal window?

I like Twitter's Bootstrap library, and I would like to try using it on my simple page. I need a modal window to automatically appear after loading the page. Can someone give me a hint how to do this?

Thanks.

+7
source share
3 answers

ok that shouldn't be too hard ... do something like this:

jQuery(document).ready(function($) { $('#my-modal').modal(options) }); 
+9
source

Your modal ...

 <div class="modal fade" id="formSaludo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 

If ulike modal is open ... Use style = "display: block;" and class = "modally fades in

 <div class="modal fade in" id="formSaludo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: block;"> 
+4
source

This modal loading when the page is ready.

 <body> <div id="top"> <a tabindex="-1" href="#" id="metadata-link" data-target="#modal" data-toggle="modal">Metadata</a> </div> <div id="modal" class="modal hide fade in" style="display:none;"> <div class="modal-header">header<a class="close" data-dismiss="modal">x</a></div> <div class="modal-body"></div> <div class="modal-footer">footer</div> </div> <script> $(document).ready(function() { $('#top').find('a').trigger('click'); }); </script> 

Best wishes.

+2
source

All Articles