1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

initial idea for handling closing of modals from whatever element you want with .js-dismiss class

This commit is contained in:
Mark Otto 2011-09-28 20:21:09 -07:00
parent 1b21d5e321
commit 2d81d65533
3 changed files with 6 additions and 6 deletions

View file

@ -1644,7 +1644,7 @@
<!-- Modal --> <!-- Modal -->
<div class="modal" style="position: relative; top: auto; left: auto; margin: 0 auto; z-index: 1"> <div class="modal" style="position: relative; top: auto; left: auto; margin: 0 auto; z-index: 1">
<div class="modal-header"> <div class="modal-header">
<a href="#" class="close">&times;</a> <a href="#" class="close js-dismiss">&times;</a>
<h3>Modal Heading</h3> <h3>Modal Heading</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
@ -1652,7 +1652,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn primary">Primary</a> <a href="#" class="btn primary">Primary</a>
<a href="#" class="btn secondary">Secondary</a> <a href="#" class="btn">Secondary</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -182,15 +182,15 @@ $('#my-modal').bind('hidden', function () {
<!-- sample modal content --> <!-- sample modal content -->
<div id="modal-from-dom" class="modal hide fade"> <div id="modal-from-dom" class="modal hide fade">
<div class="modal-header"> <div class="modal-header">
<a href="#" class="close">&times;</a> <a href="#" class="close js-dismiss">&times;</a>
<h3>Modal Heading</h3> <h3>Modal Heading</h3>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>One fine body…</p> <p>One fine body…</p>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#" class="btn primary">Primary</a> <a href="#" class="btn primary">Save changes</a>
<a href="#" class="btn secondary">Secondary</a> <a href="#" class="btn js-dismiss">Close</a>
</div> </div>
</div> </div>

View file

@ -55,7 +55,7 @@
var Modal = function ( content, options ) { var Modal = function ( content, options ) {
this.settings = $.extend({}, $.fn.modal.defaults) this.settings = $.extend({}, $.fn.modal.defaults)
this.$element = $(content) this.$element = $(content)
.delegate('.close', 'click.modal', $.proxy(this.hide, this)) .delegate('.js-dismiss', 'click.modal', $.proxy(this.hide, this))
if ( options ) { if ( options ) {
$.extend( this.settings, options ) $.extend( this.settings, options )