diff options
| author | Jacob Thornton <[email protected]> | 2012-03-24 17:50:21 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2012-03-24 17:50:21 -0700 |
| commit | ef5ac02b698ffab3a42d21f20859b70df85543c0 (patch) | |
| tree | 89b3a3abba746b0d81e05f46e6045b64700f5819 /docs | |
| parent | f9f03d8976710b8aa10abd5f89c0a699758ff0a0 (diff) | |
| download | bootstrap-ef5ac02b698ffab3a42d21f20859b70df85543c0.tar.xz bootstrap-ef5ac02b698ffab3a42d21f20859b70df85543c0.zip | |
allow prevent default for show and hide event in modal
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/assets/bootstrap.zip | bin | 56147 -> 56207 bytes | |||
| -rw-r--r-- | docs/assets/js/bootstrap-modal.js | 19 |
2 files changed, 12 insertions, 7 deletions
diff --git a/docs/assets/bootstrap.zip b/docs/assets/bootstrap.zip Binary files differindex 954f4d3e1..8ad9a0695 100644 --- a/docs/assets/bootstrap.zip +++ b/docs/assets/bootstrap.zip diff --git a/docs/assets/js/bootstrap-modal.js b/docs/assets/js/bootstrap-modal.js index e92970627..3e0fb1481 100644 --- a/docs/assets/js/bootstrap-modal.js +++ b/docs/assets/js/bootstrap-modal.js @@ -41,13 +41,15 @@ , show: function () { var that = this + , e = $.Event('show') - if (this.isShown) return + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return $('body').addClass('modal-open') this.isShown = true - this.$element.trigger('show') escape.call(this) backdrop.call(this, function () { @@ -74,18 +76,21 @@ , hide: function ( e ) { e && e.preventDefault() - if (!this.isShown) return - var that = this + + e = $.Event('hide') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + this.isShown = false $('body').removeClass('modal-open') escape.call(this) - this.$element - .trigger('hide') - .removeClass('in') + this.$element.removeClass('in') $.support.transition && this.$element.hasClass('fade') ? hideWithTransition.call(this) : |
