jekyll-theme-glueckkanja 0.8.3 → 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/_sass/font-awesome/scss/_icons.scss +91 -0
- data/_sass/font-awesome/scss/_rotated-flipped.scss +3 -2
- data/_sass/font-awesome/scss/_variables.scss +93 -1
- data/_sass/font-awesome/scss/brands.scss +1 -4
- data/_sass/font-awesome/scss/fontawesome.scss +0 -4
- data/_sass/font-awesome/scss/regular.scss +1 -4
- data/_sass/font-awesome/scss/solid.scss +1 -4
- data/_sass/font-awesome/scss/v4-shims.scss +0 -4
- data/assets/favicons/de.svg +5 -0
- data/assets/favicons/gk-logo-white.png +0 -0
- data/assets/favicons/us.svg +10 -0
- data/assets/img/cbp-sprite.png +0 -0
- data/assets/js/components/_hs.dropdown.js +612 -0
- data/assets/js/components/gmap/hs.map.js +347 -0
- data/assets/js/components/hs.ajax-autocomplete.js +103 -0
- data/assets/js/components/hs.autocomplete-local-search.js +113 -0
- data/assets/js/components/hs.autocomplete.js +125 -0
- data/assets/js/components/hs.bg-video.js +70 -0
- data/assets/js/components/hs.carousel-materialize.js +75 -0
- data/assets/js/components/hs.carousel-owl.js +89 -0
- data/assets/js/components/hs.carousel-swiper.js +123 -0
- data/assets/js/components/hs.carousel.js +283 -0
- data/assets/js/components/hs.chart-pie.js +220 -0
- data/assets/js/components/hs.chart.js +155 -0
- data/assets/js/components/hs.count-qty.js +92 -0
- data/assets/js/components/hs.countdown.js +359 -0
- data/assets/js/components/hs.counter.js +220 -0
- data/assets/js/components/hs.cubeportfolio.js +163 -0
- data/assets/js/components/hs.datepicker.js +149 -0
- data/assets/js/components/hs.dropdown.js +522 -0
- data/assets/js/components/hs.file-attachement.js +135 -0
- data/assets/js/components/hs.flickr.js +180 -0
- data/assets/js/components/hs.go-to.js +121 -0
- data/assets/js/components/hs.header-fullscreen.js +397 -0
- data/assets/js/components/hs.header-side.js +1096 -0
- data/assets/js/components/hs.header.js +2128 -0
- data/assets/js/components/hs.instagram.js +94 -0
- data/assets/js/components/hs.map.pin.js +82 -0
- data/assets/js/components/hs.map.svg.js +80 -0
- data/assets/js/components/hs.markup-copy.js +102 -0
- data/assets/js/components/hs.masked-input.js +74 -0
- data/assets/js/components/hs.modal-event.js +134 -0
- data/assets/js/components/hs.modal-window.js +422 -0
- data/assets/js/components/hs.navigation.js +690 -0
- data/assets/js/components/hs.nl-form.js +70 -0
- data/assets/js/components/hs.onscroll-animation.js +190 -0
- data/assets/js/components/hs.popup.js +310 -0
- data/assets/js/components/hs.progress-bar.js +353 -0
- data/assets/js/components/hs.rating.js +153 -0
- data/assets/js/components/hs.scroll-nav.js +373 -0
- data/assets/js/components/hs.scrollbar.js +102 -0
- data/assets/js/components/hs.select.js +91 -0
- data/assets/js/components/hs.slider.js +99 -0
- data/assets/js/components/hs.smart-menu.js +233 -0
- data/assets/js/components/hs.step-form-old.js +94 -0
- data/assets/js/components/hs.step-form.js +93 -0
- data/assets/js/components/hs.sticky-block.js +418 -0
- data/assets/js/components/hs.tabs.js +186 -0
- data/assets/js/components/hs.twitter.js +111 -0
- data/assets/js/components/hs.validation.js +111 -0
- data/assets/js/components/hs.video-audio.js +70 -0
- data/assets/js/components/text-animation/hs.text-slideshow.js +348 -0
- data/assets/js/helpers/hs.bg-video.js +23 -0
- data/assets/js/helpers/hs.chart.js +66 -0
- data/assets/js/helpers/hs.compressed-form.js +55 -0
- data/assets/js/helpers/hs.file-attachments.js +39 -0
- data/assets/js/helpers/hs.focus-state.js +37 -0
- data/assets/js/helpers/hs.hamburgers.js +69 -0
- data/assets/js/helpers/hs.height-calc.js +31 -0
- data/assets/js/helpers/hs.hover-blocks.js +43 -0
- data/assets/js/helpers/hs.modal-markup.js +89 -0
- data/assets/js/helpers/hs.navigation-splitted.js +169 -0
- data/assets/js/helpers/hs.not-empty-state.js +34 -0
- data/assets/js/helpers/hs.rating.js +45 -0
- data/assets/js/helpers/hs.selecter.js +14 -0
- data/assets/js/helpers/hs.shortcode-filter.js +39 -0
- data/assets/js/hs.core.js +250 -0
- data/assets/js/hs.popup.js +155 -0
- data/assets/js/vendor/jquery.cubeportfolio.js +6054 -0
- data/assets/js/vendor/jquery.fancybox.js +4936 -0
- data/assets/nav/pixel-trans.png +0 -0
- data/assets/nav/pixel-trans@2x.png +0 -0
- metadata +75 -1
@@ -0,0 +1,690 @@
|
|
1
|
+
/**
|
2
|
+
* Navigation component.
|
3
|
+
*
|
4
|
+
* @author Htmlstream
|
5
|
+
* @version 1.0
|
6
|
+
* @requires HSScrollBar component (hs.scrollbar.js v1.0.0)
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
;(function ($) {
|
10
|
+
'use strict';
|
11
|
+
|
12
|
+
$.HSCore.components.HSNavigation = {
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Base configuration of the component.
|
16
|
+
*
|
17
|
+
* @private
|
18
|
+
*/
|
19
|
+
_baseConfig: {
|
20
|
+
navigationOverlayClasses: '',
|
21
|
+
navigationInitClasses: '',
|
22
|
+
navigationInitBodyClasses: '',
|
23
|
+
navigationPosition: 'right',
|
24
|
+
activeClass: 'u-main-nav--overlay-opened',
|
25
|
+
navigationBreakpoint: 768,
|
26
|
+
breakpointsMap: {
|
27
|
+
'sm': 576,
|
28
|
+
'md': 768,
|
29
|
+
'lg': 992,
|
30
|
+
'xl': 1200
|
31
|
+
},
|
32
|
+
afterOpen: function(){},
|
33
|
+
afterClose: function(){}
|
34
|
+
},
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Collection of all initialized items on the page.
|
38
|
+
*
|
39
|
+
* @private
|
40
|
+
*/
|
41
|
+
_pageCollection: $(),
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Initializtion of the navigation.
|
45
|
+
*
|
46
|
+
* @param {jQuery} collection
|
47
|
+
* @param {Object} config
|
48
|
+
*
|
49
|
+
* @public
|
50
|
+
* @return {jQuery}
|
51
|
+
*/
|
52
|
+
init: function( collection, config ) {
|
53
|
+
|
54
|
+
var _self = this,
|
55
|
+
$w = $(window);
|
56
|
+
|
57
|
+
if(!collection || !collection.length) return $();
|
58
|
+
|
59
|
+
config = config && $.isPlainObject(config) ? config : {};
|
60
|
+
|
61
|
+
$w.on('resize.HSNavigation', function(e){
|
62
|
+
|
63
|
+
if(_self.resizeTimeoutId) clearTimeout(_self.resizeTimeoutId);
|
64
|
+
|
65
|
+
_self.resizeTimeoutId = setTimeout(function(){
|
66
|
+
|
67
|
+
_self._pageCollection.each(function(i, el){
|
68
|
+
|
69
|
+
var $this = $(el),
|
70
|
+
HSNavigation = $this.data('HSNavigation');
|
71
|
+
|
72
|
+
if($w.width() > HSNavigation.config.breakpointsMap[HSNavigation.config.navigationBreakpoint] && HSNavigation.isInitialized() ) {
|
73
|
+
|
74
|
+
HSNavigation.destroy();
|
75
|
+
|
76
|
+
}
|
77
|
+
else if($w.width() <= HSNavigation.config.breakpointsMap[HSNavigation.config.navigationBreakpoint] && !HSNavigation.isInitialized()) {
|
78
|
+
HSNavigation.init();
|
79
|
+
}
|
80
|
+
|
81
|
+
});
|
82
|
+
|
83
|
+
}, 50);
|
84
|
+
|
85
|
+
});
|
86
|
+
|
87
|
+
|
88
|
+
collection.each(function(i, el){
|
89
|
+
|
90
|
+
var $this = $(el),
|
91
|
+
itemConfig = $.extend(true, {}, _self._baseConfig, config, $this.data());
|
92
|
+
|
93
|
+
if( $this.data('HSNavigation') ) return;
|
94
|
+
|
95
|
+
$this.data('HSNavigation', _self._factoryMethod( $this, itemConfig ));
|
96
|
+
|
97
|
+
_self._pageCollection = _self._pageCollection.add( $this );
|
98
|
+
|
99
|
+
});
|
100
|
+
|
101
|
+
|
102
|
+
_self._pageCollection.each(function(i, el){
|
103
|
+
|
104
|
+
var $this = $(el),
|
105
|
+
HSNavigation = $this.data('HSNavigation');
|
106
|
+
|
107
|
+
if($w.width() > HSNavigation.config.breakpointsMap[HSNavigation.config.navigationBreakpoint] ) {
|
108
|
+
|
109
|
+
HSNavigation.destroy();
|
110
|
+
|
111
|
+
}
|
112
|
+
else if($w.width() <= HSNavigation.config.breakpointsMap[HSNavigation.config.navigationBreakpoint] ) {
|
113
|
+
HSNavigation.init();
|
114
|
+
}
|
115
|
+
});
|
116
|
+
|
117
|
+
return collection;
|
118
|
+
|
119
|
+
},
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Returns certain object relative to class name.
|
123
|
+
*
|
124
|
+
* @param {jQuery} element
|
125
|
+
* @param {Object} config
|
126
|
+
*
|
127
|
+
* @private
|
128
|
+
* @return {HSNavigationOverlay|HSNavigationPush}
|
129
|
+
*/
|
130
|
+
_factoryMethod: function(element, config) {
|
131
|
+
|
132
|
+
if( element.filter('[class*="u-main-nav--overlay"]').length ) {
|
133
|
+
return new HSNavigationOverlay(element, config);
|
134
|
+
}
|
135
|
+
else if ( element.filter('[class*="u-main-nav--push"]').length ) {
|
136
|
+
return new HSNavigationPush(element, config);
|
137
|
+
}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
};
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Abstract class for all HSNavigation* objects.
|
145
|
+
*
|
146
|
+
* @param {jQuery} element
|
147
|
+
* @param {Object} config
|
148
|
+
*
|
149
|
+
* @return {Boolean}
|
150
|
+
*/
|
151
|
+
function HSNavigationAbstract(element, config) {
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Contains current jQuery object.
|
155
|
+
*
|
156
|
+
* @public
|
157
|
+
*/
|
158
|
+
this.element = element;
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Contains body jQuery object.
|
162
|
+
*
|
163
|
+
* @public
|
164
|
+
*/
|
165
|
+
this.body = $('body');
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Contains configuration.
|
169
|
+
*
|
170
|
+
* @public
|
171
|
+
*/
|
172
|
+
this.config = config;
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Reinitialization of the HSNavigation* object.
|
176
|
+
*
|
177
|
+
* @public
|
178
|
+
*/
|
179
|
+
this.reinit = function() {
|
180
|
+
|
181
|
+
this.destroy().init();
|
182
|
+
|
183
|
+
}
|
184
|
+
};
|
185
|
+
|
186
|
+
/**
|
187
|
+
* HSNavigationOverlay.
|
188
|
+
*
|
189
|
+
* @param {jQuery} element
|
190
|
+
* @param {Object} config
|
191
|
+
*
|
192
|
+
* @constructor
|
193
|
+
*/
|
194
|
+
function HSNavigationOverlay(element, config) {
|
195
|
+
|
196
|
+
var _self = this;
|
197
|
+
|
198
|
+
// extends some functionality from abstract class
|
199
|
+
HSNavigationAbstract.call(this, element, config);
|
200
|
+
|
201
|
+
Object.defineProperties(this, {
|
202
|
+
|
203
|
+
overlayClasses: {
|
204
|
+
get: function() {
|
205
|
+
return 'u-main-nav__overlay ' + _self.config.navigationOverlayClasses
|
206
|
+
}
|
207
|
+
},
|
208
|
+
|
209
|
+
bodyClasses: {
|
210
|
+
get: function() {
|
211
|
+
return 'u-main-nav--overlay-' + _self.config.navigationPosition
|
212
|
+
}
|
213
|
+
},
|
214
|
+
|
215
|
+
isOpened: {
|
216
|
+
get: function() {
|
217
|
+
return _self.body.hasClass( _self.config.activeClass );
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
});
|
222
|
+
|
223
|
+
};
|
224
|
+
|
225
|
+
|
226
|
+
/**
|
227
|
+
* Initialization of the instance.
|
228
|
+
*
|
229
|
+
* @public
|
230
|
+
*/
|
231
|
+
HSNavigationOverlay.prototype.init = function() {
|
232
|
+
|
233
|
+
var _self = this;
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Contains overlay object.
|
237
|
+
*
|
238
|
+
* @public
|
239
|
+
*/
|
240
|
+
this.overlay = $('<div></div>', {
|
241
|
+
class: _self.overlayClasses
|
242
|
+
});
|
243
|
+
|
244
|
+
if( $.HSCore.components.HSScrollBar ) {
|
245
|
+
|
246
|
+
setTimeout(function(){
|
247
|
+
$.HSCore.components.HSScrollBar.init( _self.element.find( '.u-main-nav__list-wrapper' ) );
|
248
|
+
}, 10);
|
249
|
+
|
250
|
+
}
|
251
|
+
|
252
|
+
this.toggler = $('[data-target="#'+ this.element.attr('id') +'"]');
|
253
|
+
|
254
|
+
if(this.toggler && this.toggler.length) this.toggler.css('display', 'block');
|
255
|
+
|
256
|
+
this.body.addClass( this.bodyClasses );
|
257
|
+
this.element
|
258
|
+
.addClass('u-main-nav--overlay')
|
259
|
+
.append(this.overlay);
|
260
|
+
|
261
|
+
setTimeout(function(){
|
262
|
+
_self.element.addClass( _self.config.navigationInitClasses );
|
263
|
+
_self.body.addClass( _self.config.navigationInitBodyClasses );
|
264
|
+
|
265
|
+
_self.transitionDuration = parseFloat( getComputedStyle(_self.element.get(0)).transitionDuration, 10 );
|
266
|
+
|
267
|
+
|
268
|
+
if(_self.transitionDuration > 0) {
|
269
|
+
|
270
|
+
_self.element.on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", function(e){
|
271
|
+
|
272
|
+
if(_self.isOpened && (e.originalEvent.propertyName == 'right' || e.originalEvent.propertyName == 'left')) {
|
273
|
+
_self.config.afterOpen.call(_self.element, _self.overlay);
|
274
|
+
}
|
275
|
+
else if(!_self.isOpened && (e.originalEvent.propertyName == 'right' || e.originalEvent.propertyName == 'left')) {
|
276
|
+
_self.config.afterClose.call(_self.element, _self.overlay);
|
277
|
+
}
|
278
|
+
|
279
|
+
e.stopPropagation();
|
280
|
+
e.preventDefault();
|
281
|
+
|
282
|
+
});
|
283
|
+
|
284
|
+
}
|
285
|
+
|
286
|
+
},50);
|
287
|
+
|
288
|
+
this._bindEvents();
|
289
|
+
|
290
|
+
|
291
|
+
this.isInit = true;
|
292
|
+
|
293
|
+
};
|
294
|
+
|
295
|
+
|
296
|
+
/**
|
297
|
+
* Destroys the instance.
|
298
|
+
*
|
299
|
+
* @public
|
300
|
+
*/
|
301
|
+
HSNavigationOverlay.prototype.destroy = function() {
|
302
|
+
|
303
|
+
var _self = this;
|
304
|
+
|
305
|
+
if(this.overlay) this.overlay.remove();
|
306
|
+
|
307
|
+
if(this.toggler && this.toggler.length) this.toggler.hide();
|
308
|
+
|
309
|
+
if( $.HSCore.components.HSScrollBar ) {
|
310
|
+
|
311
|
+
setTimeout(function(){
|
312
|
+
$.HSCore.components.HSScrollBar.destroy( _self.element.find( '.u-main-nav__list-wrapper' ) );
|
313
|
+
}, 10);
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
setTimeout(function(){
|
318
|
+
if(_self.transitionDuration && _self.transitionDuration > 0) {
|
319
|
+
_self.element.off("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend");
|
320
|
+
}
|
321
|
+
},50);
|
322
|
+
|
323
|
+
this.body.removeClass( this.bodyClasses );
|
324
|
+
this.element
|
325
|
+
.removeClass('u-main-nav--overlay')
|
326
|
+
.removeClass(this.config.navigationInitClasses);
|
327
|
+
|
328
|
+
this.body.removeClass( this.bodyClasses ).removeClass(this.config.navigationInitBodyClasses);
|
329
|
+
|
330
|
+
this._unbindEvents();
|
331
|
+
|
332
|
+
this.isInit = false;
|
333
|
+
|
334
|
+
};
|
335
|
+
|
336
|
+
/**
|
337
|
+
* Binds necessary events.
|
338
|
+
*
|
339
|
+
* @private
|
340
|
+
*/
|
341
|
+
HSNavigationOverlay.prototype._bindEvents = function() {
|
342
|
+
|
343
|
+
var _self = this;
|
344
|
+
|
345
|
+
if(this.toggler && this.toggler.length) {
|
346
|
+
this.toggler.on('click.HSNavigation', function(e){
|
347
|
+
|
348
|
+
if(_self.isOpened) {
|
349
|
+
_self.close();
|
350
|
+
}
|
351
|
+
else {
|
352
|
+
_self.open();
|
353
|
+
}
|
354
|
+
|
355
|
+
e.preventDefault();
|
356
|
+
|
357
|
+
});
|
358
|
+
}
|
359
|
+
|
360
|
+
this.overlay.on('click.HSNavigation', function(e){
|
361
|
+
_self.close();
|
362
|
+
});
|
363
|
+
|
364
|
+
$(document).on('keyup.HSNavigation', function(e){
|
365
|
+
if(e.keyCode == 27) {
|
366
|
+
_self.close();
|
367
|
+
}
|
368
|
+
});
|
369
|
+
|
370
|
+
};
|
371
|
+
|
372
|
+
/**
|
373
|
+
* Unbinds necessary events.
|
374
|
+
*
|
375
|
+
* @private
|
376
|
+
*/
|
377
|
+
HSNavigationOverlay.prototype._unbindEvents = function() {
|
378
|
+
|
379
|
+
if(this.toggler && this.toggler.length) {
|
380
|
+
this.toggler.off('click.HSNavigation');
|
381
|
+
}
|
382
|
+
|
383
|
+
if(this.overlay && this.overlay.length) {
|
384
|
+
this.overlay.off('click.HSNavigation');
|
385
|
+
}
|
386
|
+
|
387
|
+
$(document).off('keyup.HSNavigation');
|
388
|
+
|
389
|
+
};
|
390
|
+
|
391
|
+
|
392
|
+
/**
|
393
|
+
* Shows the navigation.
|
394
|
+
*
|
395
|
+
* @public
|
396
|
+
*/
|
397
|
+
HSNavigationOverlay.prototype.open = function() {
|
398
|
+
|
399
|
+
this.body.addClass( this.config.activeClass );
|
400
|
+
|
401
|
+
if(this.transitionDuration !== undefined && this.transitionDuration == 0) {
|
402
|
+
this.config.afterOpen.call(this.element, this.overlay);
|
403
|
+
}
|
404
|
+
|
405
|
+
};
|
406
|
+
|
407
|
+
/**
|
408
|
+
* Hides the navigation.
|
409
|
+
*
|
410
|
+
* @public
|
411
|
+
*/
|
412
|
+
HSNavigationOverlay.prototype.close = function() {
|
413
|
+
|
414
|
+
var hamburgers = this.toggler && this.toggler.length ? this.toggler.find('.is-active') : $();
|
415
|
+
|
416
|
+
if(hamburgers.length) hamburgers.removeClass('is-active');
|
417
|
+
|
418
|
+
this.body.removeClass( this.config.activeClass );
|
419
|
+
|
420
|
+
if(this.transitionDuration !== undefined && this.transitionDuration == 0) {
|
421
|
+
this.config.afterClose.call(this.element, this.overlay);
|
422
|
+
}
|
423
|
+
|
424
|
+
};
|
425
|
+
|
426
|
+
/**
|
427
|
+
* Returns true if the navigation has been initialized.
|
428
|
+
*
|
429
|
+
* @public
|
430
|
+
* @return {Boolean}
|
431
|
+
*/
|
432
|
+
HSNavigationOverlay.prototype.isInitialized = function() {
|
433
|
+
|
434
|
+
return this.isInit;
|
435
|
+
|
436
|
+
};
|
437
|
+
|
438
|
+
/**
|
439
|
+
* HSNavigationPush.
|
440
|
+
*
|
441
|
+
* @param {jQuery} element
|
442
|
+
* @param {Object} config
|
443
|
+
*
|
444
|
+
* @constructor
|
445
|
+
*/
|
446
|
+
function HSNavigationPush(element, config) {
|
447
|
+
|
448
|
+
var _self = this;
|
449
|
+
|
450
|
+
// extends some functionality from abstract class
|
451
|
+
HSNavigationAbstract.call(this, element, config);
|
452
|
+
|
453
|
+
Object.defineProperties(this, {
|
454
|
+
|
455
|
+
overlayClasses: {
|
456
|
+
get: function() {
|
457
|
+
return 'u-main-nav__overlay ' + _self.config.navigationOverlayClasses
|
458
|
+
}
|
459
|
+
},
|
460
|
+
|
461
|
+
bodyClasses: {
|
462
|
+
get: function() {
|
463
|
+
return 'u-main-nav--push-' + _self.config.navigationPosition
|
464
|
+
}
|
465
|
+
},
|
466
|
+
|
467
|
+
isOpened: {
|
468
|
+
get: function() {
|
469
|
+
return _self.body.hasClass( _self.config.activeClass );
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
});
|
474
|
+
|
475
|
+
// this.init();
|
476
|
+
|
477
|
+
};
|
478
|
+
|
479
|
+
|
480
|
+
/**
|
481
|
+
* Initialization of the instance.
|
482
|
+
*
|
483
|
+
* @public
|
484
|
+
*/
|
485
|
+
HSNavigationPush.prototype.init = function() {
|
486
|
+
|
487
|
+
var _self = this;
|
488
|
+
|
489
|
+
/**
|
490
|
+
* Contains overlay object.
|
491
|
+
*
|
492
|
+
* @public
|
493
|
+
*/
|
494
|
+
this.overlay = $('<div></div>', {
|
495
|
+
class: _self.overlayClasses
|
496
|
+
});
|
497
|
+
|
498
|
+
if( $.HSCore.components.HSScrollBar ) {
|
499
|
+
|
500
|
+
setTimeout(function(){
|
501
|
+
$.HSCore.components.HSScrollBar.init( _self.element.find( '.u-main-nav__list-wrapper' ) );
|
502
|
+
}, 10);
|
503
|
+
|
504
|
+
}
|
505
|
+
|
506
|
+
this.toggler = $('[data-target="#'+ this.element.attr('id') +'"]');
|
507
|
+
|
508
|
+
if(this.toggler && this.toggler.length) this.toggler.css('display', 'block');
|
509
|
+
|
510
|
+
this.body.addClass( this.bodyClasses );
|
511
|
+
this.element
|
512
|
+
.addClass('u-main-nav--push')
|
513
|
+
.append(this.overlay);
|
514
|
+
|
515
|
+
setTimeout(function(){
|
516
|
+
_self.element.addClass( _self.config.navigationInitClasses );
|
517
|
+
_self.body.addClass( _self.config.navigationInitBodyClasses );
|
518
|
+
|
519
|
+
_self.transitionDuration = parseFloat( getComputedStyle(_self.element.get(0)).transitionDuration, 10 );
|
520
|
+
|
521
|
+
|
522
|
+
if(_self.transitionDuration > 0) {
|
523
|
+
|
524
|
+
_self.element.on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", function(e){
|
525
|
+
|
526
|
+
if(_self.isOpened && (e.originalEvent.propertyName == 'right' || e.originalEvent.propertyName == 'left')) {
|
527
|
+
_self.config.afterOpen.call(_self.element, _self.overlay);
|
528
|
+
}
|
529
|
+
else if(!_self.isOpened && (e.originalEvent.propertyName == 'right' || e.originalEvent.propertyName == 'left')) {
|
530
|
+
_self.config.afterClose.call(_self.element, _self.overlay);
|
531
|
+
}
|
532
|
+
|
533
|
+
e.stopPropagation();
|
534
|
+
e.preventDefault();
|
535
|
+
|
536
|
+
});
|
537
|
+
|
538
|
+
}
|
539
|
+
|
540
|
+
},50);
|
541
|
+
|
542
|
+
this._bindEvents();
|
543
|
+
|
544
|
+
this.isInit = true;
|
545
|
+
|
546
|
+
};
|
547
|
+
|
548
|
+
|
549
|
+
/**
|
550
|
+
* Destroys the instance.
|
551
|
+
*
|
552
|
+
* @public
|
553
|
+
*/
|
554
|
+
HSNavigationPush.prototype.destroy = function() {
|
555
|
+
|
556
|
+
var _self = this;
|
557
|
+
|
558
|
+
if(this.overlay) this.overlay.remove();
|
559
|
+
|
560
|
+
if(this.toggler && this.toggler.length) this.toggler.hide();
|
561
|
+
|
562
|
+
if( $.HSCore.components.HSScrollBar ) {
|
563
|
+
|
564
|
+
setTimeout(function(){
|
565
|
+
$.HSCore.components.HSScrollBar.destroy( _self.element.find( '.u-main-nav__list-wrapper' ) );
|
566
|
+
}, 10);
|
567
|
+
|
568
|
+
}
|
569
|
+
|
570
|
+
setTimeout(function(){
|
571
|
+
if(_self.transitionDuration && _self.transitionDuration > 0) {
|
572
|
+
_self.element.off("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend");
|
573
|
+
}
|
574
|
+
},50);
|
575
|
+
|
576
|
+
this.body.removeClass( this.bodyClasses ).removeClass(this.config.navigationInitBodyClasses);
|
577
|
+
this.element
|
578
|
+
.removeClass('u-main-nav--push')
|
579
|
+
.removeClass(this.config.navigationInitClasses);
|
580
|
+
|
581
|
+
this._unbindEvents();
|
582
|
+
|
583
|
+
this.isInit = false;
|
584
|
+
|
585
|
+
};
|
586
|
+
|
587
|
+
/**
|
588
|
+
* Binds necessary events.
|
589
|
+
*
|
590
|
+
* @private
|
591
|
+
*/
|
592
|
+
HSNavigationPush.prototype._bindEvents = function() {
|
593
|
+
|
594
|
+
var _self = this;
|
595
|
+
|
596
|
+
if(this.toggler && this.toggler.length) {
|
597
|
+
this.toggler.on('click.HSNavigation', function(e){
|
598
|
+
|
599
|
+
if(_self.isOpened) {
|
600
|
+
_self.close();
|
601
|
+
}
|
602
|
+
else {
|
603
|
+
_self.open();
|
604
|
+
}
|
605
|
+
|
606
|
+
e.preventDefault();
|
607
|
+
|
608
|
+
});
|
609
|
+
}
|
610
|
+
|
611
|
+
this.overlay.on('click.HSNavigation', function(e){
|
612
|
+
_self.close();
|
613
|
+
});
|
614
|
+
|
615
|
+
$(document).on('keyup.HSNavigation', function(e){
|
616
|
+
if(e.keyCode == 27) {
|
617
|
+
_self.close();
|
618
|
+
}
|
619
|
+
});
|
620
|
+
|
621
|
+
};
|
622
|
+
|
623
|
+
/**
|
624
|
+
* Unbinds necessary events.
|
625
|
+
*
|
626
|
+
* @private
|
627
|
+
*/
|
628
|
+
HSNavigationPush.prototype._unbindEvents = function() {
|
629
|
+
|
630
|
+
if(this.toggler && this.toggler.length) {
|
631
|
+
this.toggler.off('click.HSNavigation');
|
632
|
+
}
|
633
|
+
|
634
|
+
if(this.overlay && this.overlay.length) {
|
635
|
+
this.overlay.off('click.HSNavigation');
|
636
|
+
}
|
637
|
+
|
638
|
+
$(document).off('keyup.HSNavigation');
|
639
|
+
|
640
|
+
};
|
641
|
+
|
642
|
+
|
643
|
+
/**
|
644
|
+
* Shows the navigation.
|
645
|
+
*
|
646
|
+
* @public
|
647
|
+
*/
|
648
|
+
HSNavigationPush.prototype.open = function() {
|
649
|
+
|
650
|
+
this.body.addClass( this.config.activeClass );
|
651
|
+
|
652
|
+
if(this.transitionDuration !== undefined && this.transitionDuration == 0) {
|
653
|
+
this.config.afterOpen.call(this.element, this.overlay);
|
654
|
+
}
|
655
|
+
|
656
|
+
};
|
657
|
+
|
658
|
+
/**
|
659
|
+
* Hides the navigation.
|
660
|
+
*
|
661
|
+
* @public
|
662
|
+
*/
|
663
|
+
HSNavigationPush.prototype.close = function() {
|
664
|
+
|
665
|
+
var hamburgers = this.toggler && this.toggler.length ? this.toggler.find('.is-active') : $();
|
666
|
+
|
667
|
+
if(hamburgers.length) hamburgers.removeClass('is-active');
|
668
|
+
|
669
|
+
this.body.removeClass( this.config.activeClass );
|
670
|
+
|
671
|
+
if(this.transitionDuration !== undefined && this.transitionDuration == 0) {
|
672
|
+
this.config.afterClose.call(this.element, this.overlay);
|
673
|
+
}
|
674
|
+
|
675
|
+
};
|
676
|
+
|
677
|
+
/**
|
678
|
+
* Returns true if the navigation has been initialized.
|
679
|
+
*
|
680
|
+
* @public
|
681
|
+
* @return {Boolean}
|
682
|
+
*/
|
683
|
+
HSNavigationPush.prototype.isInitialized = function() {
|
684
|
+
|
685
|
+
return this.isInit;
|
686
|
+
|
687
|
+
};
|
688
|
+
|
689
|
+
|
690
|
+
})(jQuery);
|