front-page new structure with module-gallery and content and footer logo-gallery
1 /* ========================================================================
2 * Bootstrap: affix.js v3.0.3
3 * http://getbootstrap.com/javascript/#affix
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 // AFFIX CLASS DEFINITION
24 // ======================
26 var Affix = function (element, options) {
27 this.options = $.extend({}, Affix.DEFAULTS, options)
28 this.$window = $(window)
29 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
30 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
32 this.$element = $(element)
39 Affix.RESET = 'affix affix-top affix-bottom'
45 Affix.prototype.checkPositionWithEventLoop = function () {
46 setTimeout($.proxy(this.checkPosition, this), 1)
49 Affix.prototype.checkPosition = function () {
50 if (!this.$element.is(':visible')) return
52 var scrollHeight = $(document).height()
53 var scrollTop = this.$window.scrollTop()
54 var position = this.$element.offset()
55 var offset = this.options.offset
56 var offsetTop = offset.top
57 var offsetBottom = offset.bottom
59 if (typeof offset != 'object') offsetBottom = offsetTop = offset
60 if (typeof offsetTop == 'function') offsetTop = offset.top()
61 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom()
63 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
64 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
65 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
67 if (this.affixed === affix) return
68 if (this.unpin) this.$element.css('top', '')
71 this.unpin = affix == 'bottom' ? position.top - scrollTop : null
73 this.$element.removeClass(Affix.RESET).addClass('affix' + (affix ? '-' + affix : ''))
75 if (affix == 'bottom') {
76 this.$element.offset({ top: document.body.offsetHeight - offsetBottom - this.$element.height() })
81 // AFFIX PLUGIN DEFINITION
82 // =======================
86 $.fn.affix = function (option) {
87 return this.each(function () {
89 var data = $this.data('bs.affix')
90 var options = typeof option == 'object' && option
92 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
93 if (typeof option == 'string') data[option]()
97 $.fn.affix.Constructor = Affix
103 $.fn.affix.noConflict = function () {
112 $(window).on('load', function () {
113 $('[data-spy="affix"]').each(function () {
115 var data = $spy.data()
117 data.offset = data.offset || {}
119 if (data.offsetBottom) data.offset.bottom = data.offsetBottom
120 if (data.offsetTop) data.offset.top = data.offsetTop