app/assets/javascripts/twitter/bootstrap/modal.js in anjlab-bootstrap-rails-3.0.0.rc2 vs app/assets/javascripts/twitter/bootstrap/modal.js in anjlab-bootstrap-rails-3.0.0.0
- old
+ new
@@ -23,11 +23,11 @@
// MODAL CLASS DEFINITION
// ======================
var Modal = function (element, options) {
this.options = options
- this.$element = $(element).on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
+ this.$element = $(element)
this.$backdrop =
this.isShown = null
if (this.options.remote) this.$element.load(this.options.remote)
}
@@ -52,10 +52,12 @@
this.isShown = true
this.escape()
+ this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
+
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(document.body) // don't move modals dom position
@@ -74,11 +76,11 @@
that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
- that.$element
+ that.$element.find('.modal-dialog') // wait for modal to slide in
.one($.support.transition.end, function () {
that.$element.focus().trigger(e)
})
.emulateTransitionEnd(300) :
that.$element.focus().trigger(e)
@@ -236,9 +238,9 @@
$this.is(':visible') && $this.focus()
})
})
$(document)
- .on('shown.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
+ .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
.on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })
}(window.jQuery);