front-page new structure with module-gallery and content and footer logo-gallery
1 /* ========================================================================
2 * Bootstrap: modal.js v3.0.3
3 * http://getbootstrap.com/javascript/#modals
4 * ========================================================================
5 * Copyright 2013 Twitter, Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ======================================================================== */
21 +function ($) { "use strict";
23 // MODAL CLASS DEFINITION
24 // ======================
26 var Modal = function (element, options) {
27 this.options = options
28 this.$element = $(element)
32 if (this.options.remote) this.$element.load(this.options.remote)
41 Modal.prototype.toggle = function (_relatedTarget) {
42 return this[!this.isShown ? 'show' : 'hide'](_relatedTarget)
45 Modal.prototype.show = function (_relatedTarget) {
47 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
49 this.$element.trigger(e)
51 if (this.isShown || e.isDefaultPrevented()) return
57 this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
59 this.backdrop(function () {
60 var transition = $.support.transition && that.$element.hasClass('fade')
62 if (!that.$element.parent().length) {
63 that.$element.appendTo(document.body) // don't move modals dom position
69 that.$element[0].offsetWidth // force reflow
74 .attr('aria-hidden', false)
78 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
81 that.$element.find('.modal-dialog') // wait for modal to slide in
82 .one($.support.transition.end, function () {
83 that.$element.focus().trigger(e)
85 .emulateTransitionEnd(300) :
86 that.$element.focus().trigger(e)
90 Modal.prototype.hide = function (e) {
91 if (e) e.preventDefault()
93 e = $.Event('hide.bs.modal')
95 this.$element.trigger(e)
97 if (!this.isShown || e.isDefaultPrevented()) return
103 $(document).off('focusin.bs.modal')
107 .attr('aria-hidden', true)
108 .off('click.dismiss.modal')
110 $.support.transition && this.$element.hasClass('fade') ?
112 .one($.support.transition.end, $.proxy(this.hideModal, this))
113 .emulateTransitionEnd(300) :
117 Modal.prototype.enforceFocus = function () {
119 .off('focusin.bs.modal') // guard against infinite focus loop
120 .on('focusin.bs.modal', $.proxy(function (e) {
121 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
122 this.$element.focus()
127 Modal.prototype.escape = function () {
128 if (this.isShown && this.options.keyboard) {
129 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
130 e.which == 27 && this.hide()
132 } else if (!this.isShown) {
133 this.$element.off('keyup.dismiss.bs.modal')
137 Modal.prototype.hideModal = function () {
140 this.backdrop(function () {
141 that.removeBackdrop()
142 that.$element.trigger('hidden.bs.modal')
146 Modal.prototype.removeBackdrop = function () {
147 this.$backdrop && this.$backdrop.remove()
148 this.$backdrop = null
151 Modal.prototype.backdrop = function (callback) {
153 var animate = this.$element.hasClass('fade') ? 'fade' : ''
155 if (this.isShown && this.options.backdrop) {
156 var doAnimate = $.support.transition && animate
158 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
159 .appendTo(document.body)
161 this.$element.on('click.dismiss.modal', $.proxy(function (e) {
162 if (e.target !== e.currentTarget) return
163 this.options.backdrop == 'static'
164 ? this.$element[0].focus.call(this.$element[0])
165 : this.hide.call(this)
168 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
170 this.$backdrop.addClass('in')
172 if (!callback) return
176 .one($.support.transition.end, callback)
177 .emulateTransitionEnd(150) :
180 } else if (!this.isShown && this.$backdrop) {
181 this.$backdrop.removeClass('in')
183 $.support.transition && this.$element.hasClass('fade')?
185 .one($.support.transition.end, callback)
186 .emulateTransitionEnd(150) :
189 } else if (callback) {
195 // MODAL PLUGIN DEFINITION
196 // =======================
200 $.fn.modal = function (option, _relatedTarget) {
201 return this.each(function () {
203 var data = $this.data('bs.modal')
204 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
206 if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
207 if (typeof option == 'string') data[option](_relatedTarget)
208 else if (options.show) data.show(_relatedTarget)
212 $.fn.modal.Constructor = Modal
218 $.fn.modal.noConflict = function () {
227 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
229 var href = $this.attr('href')
230 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
231 var option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
237 .one('hide', function () {
238 $this.is(':visible') && $this.focus()
243 .on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') })
244 .on('hidden.bs.modal', '.modal', function () { $(document.body).removeClass('modal-open') })