front-page new structure with module-gallery and content and footer logo-gallery
1 /* ========================================================================
2 * Bootstrap: dropdown.js v3.0.3
3 * http://getbootstrap.com/javascript/#dropdowns
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 // DROPDOWN CLASS DEFINITION
24 // =========================
26 var backdrop = '.dropdown-backdrop'
27 var toggle = '[data-toggle=dropdown]'
28 var Dropdown = function (element) {
29 $(element).on('click.bs.dropdown', this.toggle)
32 Dropdown.prototype.toggle = function (e) {
35 if ($this.is('.disabled, :disabled')) return
37 var $parent = getParent($this)
38 var isActive = $parent.hasClass('open')
43 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
44 // if mobile we use a backdrop because click events don't delegate
45 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
48 $parent.trigger(e = $.Event('show.bs.dropdown'))
50 if (e.isDefaultPrevented()) return
54 .trigger('shown.bs.dropdown')
62 Dropdown.prototype.keydown = function (e) {
63 if (!/(38|40|27)/.test(e.keyCode)) return
70 if ($this.is('.disabled, :disabled')) return
72 var $parent = getParent($this)
73 var isActive = $parent.hasClass('open')
75 if (!isActive || (isActive && e.keyCode == 27)) {
76 if (e.which == 27) $parent.find(toggle).focus()
80 var $items = $('[role=menu] li:not(.divider):visible a', $parent)
82 if (!$items.length) return
84 var index = $items.index($items.filter(':focus'))
86 if (e.keyCode == 38 && index > 0) index-- // up
87 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
90 $items.eq(index).focus()
93 function clearMenus() {
95 $(toggle).each(function (e) {
96 var $parent = getParent($(this))
97 if (!$parent.hasClass('open')) return
98 $parent.trigger(e = $.Event('hide.bs.dropdown'))
99 if (e.isDefaultPrevented()) return
100 $parent.removeClass('open').trigger('hidden.bs.dropdown')
104 function getParent($this) {
105 var selector = $this.attr('data-target')
108 selector = $this.attr('href')
109 selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
112 var $parent = selector && $(selector)
114 return $parent && $parent.length ? $parent : $this.parent()
118 // DROPDOWN PLUGIN DEFINITION
119 // ==========================
121 var old = $.fn.dropdown
123 $.fn.dropdown = function (option) {
124 return this.each(function () {
126 var data = $this.data('bs.dropdown')
128 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
129 if (typeof option == 'string') data[option].call($this)
133 $.fn.dropdown.Constructor = Dropdown
136 // DROPDOWN NO CONFLICT
137 // ====================
139 $.fn.dropdown.noConflict = function () {
145 // APPLY TO STANDARD DROPDOWN ELEMENTS
146 // ===================================
149 .on('click.bs.dropdown.data-api', clearMenus)
150 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
151 .on('click.bs.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
152 .on('keydown.bs.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)