comparison static/bootstrap/js/bootstrap-modal.js @ 88:a5a3d454eac9

Updated Bootstrap.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 05 Apr 2013 08:08:12 -0700
parents 130eccd396d8
children
comparison
equal deleted inserted replaced
87:c0cf67362fb1 88:a5a3d454eac9
1 /* ========================================================= 1 /* =========================================================
2 * bootstrap-modal.js v2.2.2 2 * bootstrap-modal.js v2.3.1
3 * http://twitter.github.com/bootstrap/javascript.html#modals 3 * http://twitter.github.com/bootstrap/javascript.html#modals
4 * ========================================================= 4 * =========================================================
5 * Copyright 2012 Twitter, Inc. 5 * Copyright 2012 Twitter, Inc.
6 * 6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * Licensed under the Apache License, Version 2.0 (the "License");
58 58
59 if (!that.$element.parent().length) { 59 if (!that.$element.parent().length) {
60 that.$element.appendTo(document.body) //don't move modals dom position 60 that.$element.appendTo(document.body) //don't move modals dom position
61 } 61 }
62 62
63 that.$element 63 that.$element.show()
64 .show()
65 64
66 if (transition) { 65 if (transition) {
67 that.$element[0].offsetWidth // force reflow 66 that.$element[0].offsetWidth // force reflow
68 } 67 }
69 68
137 clearTimeout(timeout) 136 clearTimeout(timeout)
138 that.hideModal() 137 that.hideModal()
139 }) 138 })
140 } 139 }
141 140
142 , hideModal: function (that) { 141 , hideModal: function () {
143 this.$element 142 var that = this
144 .hide() 143 this.$element.hide()
145 .trigger('hidden') 144 this.backdrop(function () {
146 145 that.removeBackdrop()
147 this.backdrop() 146 that.$element.trigger('hidden')
147 })
148 } 148 }
149 149
150 , removeBackdrop: function () { 150 , removeBackdrop: function () {
151 this.$backdrop.remove() 151 this.$backdrop && this.$backdrop.remove()
152 this.$backdrop = null 152 this.$backdrop = null
153 } 153 }
154 154
155 , backdrop: function (callback) { 155 , backdrop: function (callback) {
156 var that = this 156 var that = this
170 170
171 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow 171 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
172 172
173 this.$backdrop.addClass('in') 173 this.$backdrop.addClass('in')
174 174
175 if (!callback) return
176
175 doAnimate ? 177 doAnimate ?
176 this.$backdrop.one($.support.transition.end, callback) : 178 this.$backdrop.one($.support.transition.end, callback) :
177 callback() 179 callback()
178 180
179 } else if (!this.isShown && this.$backdrop) { 181 } else if (!this.isShown && this.$backdrop) {
180 this.$backdrop.removeClass('in') 182 this.$backdrop.removeClass('in')
181 183
182 $.support.transition && this.$element.hasClass('fade')? 184 $.support.transition && this.$element.hasClass('fade')?
183 this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) : 185 this.$backdrop.one($.support.transition.end, callback) :
184 this.removeBackdrop() 186 callback()
185 187
186 } else if (callback) { 188 } else if (callback) {
187 callback() 189 callback()
188 } 190 }
189 } 191 }