Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/bootstrap-modal.js')
-rw-r--r--js/bootstrap-modal.js45
1 files changed, 20 insertions, 25 deletions
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index f1622b1c65..a9972595c5 100644
--- a/js/bootstrap-modal.js
+++ b/js/bootstrap-modal.js
@@ -1,5 +1,5 @@
/* =========================================================
- * bootstrap-modal.js v2.1.1
+ * bootstrap-modal.js v2.2.0
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
@@ -49,8 +49,6 @@
if (this.isShown || e.isDefaultPrevented()) return
- $('body').addClass('modal-open')
-
this.isShown = true
this.escape()
@@ -72,13 +70,12 @@
that.$element
.addClass('in')
.attr('aria-hidden', false)
- .focus()
that.enforceFocus()
transition ?
- that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
- that.$element.trigger('shown')
+ that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
+ that.$element.focus().trigger('shown')
})
}
@@ -96,8 +93,6 @@
this.isShown = false
- $('body').removeClass('modal-open')
-
this.escape()
$(document).off('focusin.modal')
@@ -167,9 +162,11 @@
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
- if (this.options.backdrop != 'static') {
- this.$backdrop.click($.proxy(this.hide, this))
- }
+ this.$backdrop.click(
+ this.options.backdrop == 'static' ?
+ $.proxy(this.$element[0].focus, this.$element[0])
+ : $.proxy(this.hide, this)
+ )
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
@@ -219,21 +216,19 @@
/* MODAL DATA-API
* ============== */
- $(function () {
- $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
- var $this = $(this)
- , href = $this.attr('href')
- , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
- , option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
+ $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
+ var $this = $(this)
+ , href = $this.attr('href')
+ , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
+ , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
- e.preventDefault()
+ e.preventDefault()
- $target
- .modal(option)
- .one('hide', function () {
- $this.focus()
- })
- })
+ $target
+ .modal(option)
+ .one('hide', function () {
+ $this.focus()
+ })
})
-}(window.jQuery); \ No newline at end of file
+}(window.jQuery);