topical media & game development
mobile-query-three-www-vendor-doccoviewer-vendor-bootstrap-js-bootstrap-modal.js / js
/* =========================================================
* bootstrap-modal.js v2.0.0
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function( element = content
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', element.trigger('show')
escape.call(this)
backdrop.call(this, function () {
var transition = element.hasClass('fade')
!that.element.appendTo(document.body) //don't move modals dom position
that.element[0].offsetWidth // force reflow
}
that.element.one(element.trigger('shown') }) :
that.element
.trigger('hide')
.removeClass('in')
element.hasClass('fade') ?
hideWithTransition.call(this) :
hideModal.call(this)
}
}
/* MODAL PRIVATE METHODS
* ===================== */
function hideWithTransition() {
var that = this
, timeout = setTimeout(function () {
that..support.transition.end)
hideModal.call(that)
}, 500)
this..support.transition.end, function () {
clearTimeout(timeout)
hideModal.call(that)
})
}
function hideModal( that ) {
this.element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
if (this.options.backdrop != 'static') {
this..proxy(this.hide, this))
}
if (doAnimate) this.backdrop.addClass('in')
doAnimate ?
this..support.transition.end, callback) :
callback()
} else if (!this.isShown && this.backdrop.removeClass('in')
element.hasClass('fade')?
this..support.transition.end, backdrop.remove()
this..fn.modal = function ( option ) {
return this.each(function () {
var this.data('modal')
, options = .fn.modal.defaults, typeof option == 'object' && option)
if (!data) .fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
this = this, href
, this.attr('data-target') || (href = )/, '')) //strip for ie7
, option = .extend({}, this.data())
e.preventDefault()
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.