1a13dd35326da34162ddc28c91cbed5c5f6724e7
4 Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
9 var $window
= $(window
),
11 $wrapper
= $('#wrapper'),
12 $header
= $('#header'),
13 $banner
= $('#banner');
17 xlarge
: ['1281px', '1680px' ],
18 large
: ['981px', '1280px' ],
19 medium
: ['737px', '980px' ],
20 small
: ['481px', '736px' ],
21 xsmall
: ['361px', '480px' ],
22 xxsmall
: [null, '360px' ]
26 * Applies parallax scrolling to an element's background image.
27 * @return {jQuery} jQuery object.
29 $.fn
._parallax
= (browser
.name
== 'ie' || browser
.name
== 'edge' || browser
.mobile
) ? function() { return $(this) } : function(intensity
) {
31 var $window
= $(window
),
34 if (this.length
== 0 || intensity
=== 0)
37 if (this.length
> 1) {
39 for (var i
=0; i
< this.length
; i
++)
40 $(this[i
])._parallax(intensity
);
49 $this.each(function() {
56 $t
.css('background-position', 'center 100%, center 100%, center 0px');
59 .on('scroll._parallax', function() {
61 var pos
= parseInt($window
.scrollTop()) - parseInt($t
.position().top
);
63 $t
.css('background-position', 'center ' + (pos
* (-1 * intensity
)) + 'px');
72 .css('background-position', '');
75 .off('scroll._parallax');
79 breakpoints
.on('<=medium', off
);
80 breakpoints
.on('>medium', on
);
85 .off('load._parallax resize._parallax')
86 .on('load._parallax resize._parallax', function() {
87 $window
.trigger('scroll');
94 // Play initial animations on page load.
95 $window
.on('load', function() {
96 window
.setTimeout(function() {
97 $body
.removeClass('is-preload');
101 // Clear transitioning state on unload/hide.
102 $window
.on('unload pagehide', function() {
103 window
.setTimeout(function() {
104 $('.is-transitioning').removeClass('is-transitioning');
108 // Fix: Enable IE-only tweaks.
109 if (browser
.name
== 'ie' || browser
.name
== 'edge')
110 $body
.addClass('is-ie');
113 $('.scrolly').scrolly({
115 return $header
.height() - 2;
120 var $tiles
= $('.tiles > article');
122 $tiles
.each(function() {
125 $image
= $this.find('.image'), $img
= $image
.find('img'),
126 $link
= $this.find('.link'),
132 $this.css('background-image', 'url(' + $img
.attr('src') + ')');
135 if (x
= $img
.data('position'))
136 $image
.css('background-position', x
);
142 if ($link
.length
> 0) {
149 $link
= $link
.add($x
);
151 $link
.on('click', function(event
) {
153 var href
= $link
.attr('href');
156 event
.stopPropagation();
157 event
.preventDefault();
160 if ($link
.attr('target') == '_blank') {
170 // Start transitioning.
171 $this.addClass('is-transitioning');
172 $wrapper
.addClass('is-transitioning');
175 window
.setTimeout(function() {
176 location
.href
= href
;
188 if ($banner
.length
> 0
189 && $header
.hasClass('alt')) {
191 $window
.on('resize', function() {
192 $window
.trigger('scroll');
195 $window
.on('load', function() {
198 bottom
: $header
.height() + 10,
199 terminate: function() { $header
.removeClass('alt'); },
200 enter: function() { $header
.addClass('alt'); },
201 leave: function() { $header
.removeClass('alt'); $header
.addClass('reveal'); }
204 window
.setTimeout(function() {
205 $window
.triggerHandler('scroll');
213 $banner
.each(function() {
216 $image
= $this.find('.image'), $img
= $image
.find('img');
219 $this._parallax(0.275);
222 if ($image
.length
> 0) {
225 $this.css('background-image', 'url(' + $img
.attr('src') + ')');
235 var $menu
= $('#menu'),
238 $menu
.wrapInner('<div class="inner"></div>');
239 $menuInner
= $menu
.children('.inner');
240 $menu
._locked
= false;
242 $menu
._lock = function() {
247 $menu
._locked
= true;
249 window
.setTimeout(function() {
250 $menu
._locked
= false;
257 $menu
._show = function() {
260 $body
.addClass('is-menu-visible');
264 $menu
._hide = function() {
267 $body
.removeClass('is-menu-visible');
271 $menu
._toggle = function() {
274 $body
.toggleClass('is-menu-visible');
279 .on('click', function(event
) {
280 event
.stopPropagation();
282 .on('click', 'a', function(event
) {
284 var href
= $(this).attr('href');
286 event
.preventDefault();
287 event
.stopPropagation();
293 window
.setTimeout(function() {
294 window
.location
.href
= href
;
301 .on('click', function(event
) {
303 event
.stopPropagation();
304 event
.preventDefault();
306 $body
.removeClass('is-menu-visible');
309 .append('<a class="close" href="#menu">Close</a>');
312 .on('click', 'a[href="#menu"]', function(event
) {
314 event
.stopPropagation();
315 event
.preventDefault();
321 .on('click', function(event
) {
327 .on('keydown', function(event
) {
330 if (event
.keyCode
== 27)