@brandocms/jupiter 3.46.4 → 3.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/events/index.js +1 -0
- package/src/index.js +7 -7
- package/src/modules/Application/index.js +119 -80
- package/src/modules/Breakpoints/index.js +14 -17
- package/src/modules/Cookies/index.js +86 -43
- package/src/modules/CoverOverlay/index.js +6 -3
- package/src/modules/Dataloader/index.js +173 -7
- package/src/modules/Dom/index.js +26 -26
- package/src/modules/Dropdown/index.js +14 -14
- package/src/modules/EqualHeightElements/index.js +70 -0
- package/src/modules/EqualHeightImages/index.js +95 -0
- package/src/modules/FeatureTests/index.js +22 -15
- package/src/modules/FixedHeader/index.js +79 -75
- package/src/modules/Fontloader/index.js +5 -3
- package/src/modules/FooterReveal/index.js +1 -1
- package/src/modules/HeroSlider/index.js +33 -23
- package/src/modules/HeroVideo/index.js +15 -13
- package/src/modules/Lazyload/index.js +119 -65
- package/src/modules/Lightbox/index.js +40 -43
- package/src/modules/Links/index.js +8 -7
- package/src/modules/Marquee/index.js +47 -37
- package/src/modules/MobileMenu/index.js +112 -65
- package/src/modules/Moonwalk/index.js +256 -203
- package/src/modules/Parallax/index.js +24 -14
- package/src/modules/Popup/index.js +24 -21
- package/src/modules/ScrollSpy/index.js +5 -5
- package/src/modules/StackedBoxes/index.js +5 -5
- package/src/modules/StickyHeader/index.js +73 -70
- package/src/modules/Toggler/index.js +2 -2
- package/src/modules/Typography/index.js +13 -10
- package/src/utils/dispatchElementEvent.js +2 -2
- package/src/utils/imageIsLoaded.js +1 -1
- package/src/utils/imagesAreLoaded.js +3 -3
- package/src/utils/loadScript.js +9 -8
- package/src/utils/rafCallback.js +12 -10
- package/src/utils/zoom.js +11 -8
|
@@ -53,8 +53,7 @@ const DEFAULT_OPTIONS = {
|
|
|
53
53
|
return
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
lightbox.timelines.caption
|
|
57
|
-
.to(lightbox.elements.caption, { duration: 0.4, autoAlpha: 0 })
|
|
56
|
+
lightbox.timelines.caption.to(lightbox.elements.caption, { duration: 0.4, autoAlpha: 0 })
|
|
58
57
|
},
|
|
59
58
|
|
|
60
59
|
onCaptionIn: (lightbox, captionHasChanged) => {
|
|
@@ -62,19 +61,16 @@ const DEFAULT_OPTIONS = {
|
|
|
62
61
|
return
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
lightbox.timelines.caption
|
|
66
|
-
.to(lightbox.elements.caption, { duration: 0.4, autoAlpha: 1 })
|
|
64
|
+
lightbox.timelines.caption.to(lightbox.elements.caption, { duration: 0.4, autoAlpha: 1 })
|
|
67
65
|
},
|
|
68
66
|
|
|
69
67
|
onImageOut: lightbox => {
|
|
70
|
-
lightbox.timelines.image
|
|
71
|
-
.to(lightbox.currentImage, { duration: 0.5, autoAlpha: 0 })
|
|
68
|
+
lightbox.timelines.image.to(lightbox.currentImage, { duration: 0.5, autoAlpha: 0 })
|
|
72
69
|
},
|
|
73
70
|
|
|
74
71
|
onImageIn: lightbox => {
|
|
75
72
|
const delay = lightbox.firstTransition ? 0.6 : 0.4
|
|
76
|
-
lightbox.timelines.image
|
|
77
|
-
.to(lightbox.nextImage, { duration: 0.5, autoAlpha: 1, delay })
|
|
73
|
+
lightbox.timelines.image.to(lightbox.nextImage, { duration: 0.5, autoAlpha: 1, delay })
|
|
78
74
|
},
|
|
79
75
|
|
|
80
76
|
onBeforeOpen: () => {},
|
|
@@ -98,31 +94,34 @@ const DEFAULT_OPTIONS = {
|
|
|
98
94
|
})
|
|
99
95
|
}
|
|
100
96
|
|
|
101
|
-
gsap.to(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
97
|
+
gsap.to(
|
|
98
|
+
[
|
|
99
|
+
h.elements.imgWrapper,
|
|
100
|
+
h.elements.nextArrow,
|
|
101
|
+
h.elements.prevArrow,
|
|
102
|
+
h.elements.close,
|
|
103
|
+
h.elements.dots
|
|
104
|
+
],
|
|
105
|
+
{
|
|
106
|
+
duration: 0.5,
|
|
107
|
+
opacity: 0,
|
|
108
|
+
onComplete: () => {
|
|
109
|
+
gsap.to(h.elements.wrapper, {
|
|
110
|
+
duration: 0.45,
|
|
111
|
+
opacity: 0,
|
|
112
|
+
onComplete: () => {
|
|
113
|
+
h.app.scrollRelease()
|
|
114
|
+
h.destroy()
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
}
|
|
119
118
|
}
|
|
120
|
-
|
|
119
|
+
)
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
|
|
124
123
|
export default class Lightbox {
|
|
125
|
-
constructor
|
|
124
|
+
constructor(app, opts = {}) {
|
|
126
125
|
this.app = app
|
|
127
126
|
this.opts = _defaultsDeep(opts, DEFAULT_OPTIONS)
|
|
128
127
|
this.lightboxes = document.querySelectorAll('[data-lightbox]')
|
|
@@ -168,12 +167,12 @@ export default class Lightbox {
|
|
|
168
167
|
})
|
|
169
168
|
}
|
|
170
169
|
|
|
171
|
-
showBox
|
|
170
|
+
showBox(section, index) {
|
|
172
171
|
this.opts.onBeforeOpen(this)
|
|
173
172
|
this.buildBox(section, index)
|
|
174
173
|
}
|
|
175
174
|
|
|
176
|
-
buildBox
|
|
175
|
+
buildBox(section, index) {
|
|
177
176
|
this.elements.wrapper = document.createElement('div')
|
|
178
177
|
this.elements.content = document.createElement('div')
|
|
179
178
|
this.elements.imgWrapper = document.createElement('div')
|
|
@@ -289,7 +288,7 @@ export default class Lightbox {
|
|
|
289
288
|
})
|
|
290
289
|
}
|
|
291
290
|
|
|
292
|
-
close
|
|
291
|
+
close() {
|
|
293
292
|
document.removeEventListener('keyup', this.onKeyup.bind(this))
|
|
294
293
|
this.opts.onClose(this)
|
|
295
294
|
this.opts.onAfterClose(this)
|
|
@@ -299,11 +298,11 @@ export default class Lightbox {
|
|
|
299
298
|
this.imgs = []
|
|
300
299
|
}
|
|
301
300
|
|
|
302
|
-
destroy
|
|
301
|
+
destroy() {
|
|
303
302
|
this.elements.wrapper.parentNode.removeChild(this.elements.wrapper)
|
|
304
303
|
}
|
|
305
304
|
|
|
306
|
-
setImg
|
|
305
|
+
setImg(section, index) {
|
|
307
306
|
let captionHasChanged = false
|
|
308
307
|
|
|
309
308
|
this.currentIndex = index
|
|
@@ -319,9 +318,7 @@ export default class Lightbox {
|
|
|
319
318
|
activeDot.classList.add('active')
|
|
320
319
|
|
|
321
320
|
if (this.elements.caption) {
|
|
322
|
-
captionHasChanged =
|
|
323
|
-
this.previousCaption !== this.sections[section][index].alt
|
|
324
|
-
)
|
|
321
|
+
captionHasChanged = this.previousCaption !== this.sections[section][index].alt
|
|
325
322
|
this.previousCaption = this.sections[section][index].alt
|
|
326
323
|
this.opts.onCaptionOut(this, captionHasChanged)
|
|
327
324
|
this.timelines.caption.call(() => {
|
|
@@ -372,7 +369,7 @@ export default class Lightbox {
|
|
|
372
369
|
this.currentImage = this.nextImage
|
|
373
370
|
}
|
|
374
371
|
|
|
375
|
-
getNextIdx
|
|
372
|
+
getNextIdx(section) {
|
|
376
373
|
const index = this.currentIndex
|
|
377
374
|
if (index === this.sections[section].length - 1) {
|
|
378
375
|
return 0
|
|
@@ -380,7 +377,7 @@ export default class Lightbox {
|
|
|
380
377
|
return index + 1
|
|
381
378
|
}
|
|
382
379
|
|
|
383
|
-
getPrevIdx
|
|
380
|
+
getPrevIdx(section) {
|
|
384
381
|
const index = this.currentIndex
|
|
385
382
|
if (index === 0) {
|
|
386
383
|
return this.sections[section].length - 1
|
|
@@ -388,11 +385,11 @@ export default class Lightbox {
|
|
|
388
385
|
return index - 1
|
|
389
386
|
}
|
|
390
387
|
|
|
391
|
-
onClick
|
|
388
|
+
onClick(e, section) {
|
|
392
389
|
this.opts.onClick(this, section, e)
|
|
393
390
|
}
|
|
394
391
|
|
|
395
|
-
onKeyup
|
|
392
|
+
onKeyup(e, section) {
|
|
396
393
|
const key = e.keyCode || e.which
|
|
397
394
|
|
|
398
395
|
switch (key) {
|
|
@@ -410,8 +407,8 @@ export default class Lightbox {
|
|
|
410
407
|
}
|
|
411
408
|
}
|
|
412
409
|
|
|
413
|
-
onMouseMove
|
|
414
|
-
if (e.clientX <
|
|
410
|
+
onMouseMove(e) {
|
|
411
|
+
if (e.clientX < this.app.size.width / 2) {
|
|
415
412
|
if (this.pointerDirection === 'left') {
|
|
416
413
|
return
|
|
417
414
|
}
|
|
@@ -426,7 +423,7 @@ export default class Lightbox {
|
|
|
426
423
|
}
|
|
427
424
|
}
|
|
428
425
|
|
|
429
|
-
attachSwiper
|
|
426
|
+
attachSwiper(section, el, initialIdx) {
|
|
430
427
|
const hammerManager = new Manager(el)
|
|
431
428
|
const swipeHandler = new Swipe()
|
|
432
429
|
|
|
@@ -20,7 +20,6 @@ const DEFAULT_OPTIONS = {
|
|
|
20
20
|
const header = document.querySelector('header[data-nav]')
|
|
21
21
|
const footer = document.querySelector('footer')
|
|
22
22
|
const fader = document.querySelector('#fader')
|
|
23
|
-
console.log('transition')
|
|
24
23
|
|
|
25
24
|
if (fader) {
|
|
26
25
|
gsap.set(fader, { display: 'block', opacity: 0 })
|
|
@@ -51,7 +50,7 @@ const DEFAULT_OPTIONS = {
|
|
|
51
50
|
y: 25,
|
|
52
51
|
ease: 'power3.out'
|
|
53
52
|
})
|
|
54
|
-
|
|
53
|
+
|
|
55
54
|
if (header) {
|
|
56
55
|
gsap.to(header, { duration: 0.2, opacity: 0 })
|
|
57
56
|
}
|
|
@@ -72,7 +71,7 @@ const DEFAULT_OPTIONS = {
|
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
export default class Links {
|
|
75
|
-
constructor
|
|
74
|
+
constructor(app, opts = {}) {
|
|
76
75
|
this.app = app
|
|
77
76
|
this.opts = _defaultsDeep(opts, DEFAULT_OPTIONS)
|
|
78
77
|
|
|
@@ -84,7 +83,7 @@ export default class Links {
|
|
|
84
83
|
this.bindLinks(links)
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
bindHeroLink
|
|
86
|
+
bindHeroLink() {
|
|
88
87
|
const el = document.querySelector('[data-link-to-content]')
|
|
89
88
|
if (el) {
|
|
90
89
|
el.addEventListener('click', e => {
|
|
@@ -97,7 +96,7 @@ export default class Links {
|
|
|
97
96
|
}
|
|
98
97
|
}
|
|
99
98
|
|
|
100
|
-
bindAnchors
|
|
99
|
+
bindAnchors(anchors) {
|
|
101
100
|
let wait = false
|
|
102
101
|
Array.from(anchors).forEach(anchor => {
|
|
103
102
|
anchor.addEventListener('click', e => {
|
|
@@ -122,7 +121,9 @@ export default class Links {
|
|
|
122
121
|
this.opts.onAnchor(dataTarget, this)
|
|
123
122
|
|
|
124
123
|
if (this.app.header && dataTarget.id !== 'top') {
|
|
125
|
-
setTimeout(() => {
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
this.app.header.unpin()
|
|
126
|
+
}, 800)
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -136,7 +137,7 @@ export default class Links {
|
|
|
136
137
|
})
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
bindLinks
|
|
140
|
+
bindLinks(links) {
|
|
140
141
|
Array.from(links).forEach(link => {
|
|
141
142
|
link.addEventListener('click', e => {
|
|
142
143
|
const loadingContainer = document.querySelector('.loading-container')
|
|
@@ -8,14 +8,15 @@ const DEFAULT_OPTIONS = {
|
|
|
8
8
|
slowDownOnHover: true,
|
|
9
9
|
paddingLeft: 0, //DEPRECATED
|
|
10
10
|
startProgress: 0,
|
|
11
|
+
spacer: '<span> — </span>',
|
|
11
12
|
|
|
12
13
|
onReveal: marqueeEl => {
|
|
13
|
-
gsap.to(marqueeEl, { opacity: 1 })
|
|
14
|
+
gsap.to(marqueeEl, { opacity: 1, ease: 'none' })
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export default class Marquee {
|
|
18
|
-
constructor
|
|
19
|
+
constructor(app, el, opts) {
|
|
19
20
|
this.opts = _defaultsDeep(opts, DEFAULT_OPTIONS)
|
|
20
21
|
this.app = app
|
|
21
22
|
this.elements = {}
|
|
@@ -29,7 +30,7 @@ export default class Marquee {
|
|
|
29
30
|
this.initialize()
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
initialize
|
|
33
|
+
initialize() {
|
|
33
34
|
gsap.set(this.elements.$marquee, { opacity: 0 })
|
|
34
35
|
window.addEventListener('APPLICATION:RESIZE', this.updateMarquee.bind(this))
|
|
35
36
|
window.addEventListener('APPLICATION:REVEALED', this.revealMarquee.bind(this))
|
|
@@ -41,12 +42,12 @@ export default class Marquee {
|
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
revealMarquee
|
|
45
|
+
revealMarquee(e) {
|
|
45
46
|
this.updateMarquee()
|
|
46
47
|
this.opts.onReveal(this.elements.$marquee)
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
updateMarquee
|
|
50
|
+
updateMarquee(e) {
|
|
50
51
|
if (e) {
|
|
51
52
|
// updating cause of a resize. we only care about width change
|
|
52
53
|
if (!e.detail.widthChanged) {
|
|
@@ -62,7 +63,7 @@ export default class Marquee {
|
|
|
62
63
|
const holderWidth = this.elements.$holder.offsetWidth
|
|
63
64
|
const $allHolders = Dom.all(this.elements.$el, '[data-marquee-holder]')
|
|
64
65
|
const marqueeWidth = holderWidth * $allHolders.length
|
|
65
|
-
|
|
66
|
+
|
|
66
67
|
this.duration = holderWidth / this.opts.speed
|
|
67
68
|
|
|
68
69
|
gsap.set(this.elements.$marquee, { width: marqueeWidth })
|
|
@@ -73,23 +74,23 @@ export default class Marquee {
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
|
|
76
|
-
clearHolders
|
|
77
|
+
clearHolders() {
|
|
77
78
|
const $allHolders = Dom.all(this.elements.$el, '[data-marquee-holder]')
|
|
78
79
|
Array.from($allHolders).forEach(h => gsap.set(h, { clearProps: 'all' }))
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
killTweens
|
|
82
|
+
killTweens() {
|
|
82
83
|
if (this.timeline) {
|
|
83
84
|
this.timeline.kill()
|
|
84
85
|
this.timeline = null
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
initializeTween
|
|
89
|
+
initializeTween() {
|
|
89
90
|
const $allHolders = Dom.all(this.elements.$el, '[data-marquee-holder]')
|
|
90
91
|
|
|
91
92
|
Array.from($allHolders).forEach((h, idx) => {
|
|
92
|
-
gsap.set(h, { position: 'absolute', left:
|
|
93
|
+
gsap.set(h, { position: 'absolute', left: h.offsetWidth * idx })
|
|
93
94
|
})
|
|
94
95
|
|
|
95
96
|
this.timeline = gsap.timeline({ paused: true })
|
|
@@ -103,7 +104,7 @@ export default class Marquee {
|
|
|
103
104
|
window.marquee = this
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
play
|
|
107
|
+
play(rampUp = false) {
|
|
107
108
|
this.playing = true
|
|
108
109
|
gsap.killTweensOf(this.timeline)
|
|
109
110
|
|
|
@@ -120,7 +121,7 @@ export default class Marquee {
|
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
pause
|
|
124
|
+
pause() {
|
|
124
125
|
this.playing = false
|
|
125
126
|
gsap.to(this.timeline, {
|
|
126
127
|
timeScale: 0.01,
|
|
@@ -131,14 +132,14 @@ export default class Marquee {
|
|
|
131
132
|
})
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
slowDown
|
|
135
|
+
slowDown() {
|
|
135
136
|
gsap.to(this.timeline, {
|
|
136
137
|
timeScale: 0.5,
|
|
137
138
|
duration: 0.8
|
|
138
139
|
})
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
speedUp
|
|
142
|
+
speedUp() {
|
|
142
143
|
gsap.to(this.timeline, {
|
|
143
144
|
timeScale: 1,
|
|
144
145
|
duration: 0.8,
|
|
@@ -146,50 +147,59 @@ export default class Marquee {
|
|
|
146
147
|
})
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
setupObserver
|
|
150
|
-
this.observer = new IntersectionObserver(
|
|
151
|
-
entries
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
this.
|
|
156
|
-
|
|
157
|
-
this.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
150
|
+
setupObserver() {
|
|
151
|
+
this.observer = new IntersectionObserver(
|
|
152
|
+
entries => {
|
|
153
|
+
entries.forEach(entry => {
|
|
154
|
+
const { isIntersecting } = entry
|
|
155
|
+
|
|
156
|
+
if (isIntersecting && !this.playing) {
|
|
157
|
+
this.play()
|
|
158
|
+
} else if (!isIntersecting && this.playing) {
|
|
159
|
+
this.pause()
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
root: null,
|
|
165
|
+
threshold: 0
|
|
166
|
+
}
|
|
167
|
+
)
|
|
164
168
|
|
|
165
169
|
this.observer.observe(this.elements.$el)
|
|
166
170
|
}
|
|
167
171
|
|
|
168
|
-
fillText
|
|
172
|
+
fillText() {
|
|
169
173
|
this.elements.$marquee.innerHTML = ''
|
|
170
174
|
this.elements.$marquee.appendChild(this.elements.$holder)
|
|
171
175
|
|
|
172
176
|
this.elements.$holder.innerHTML = ''
|
|
173
177
|
this.elements.$holder.appendChild(this.elements.$item)
|
|
174
178
|
|
|
175
|
-
this.elements.$holder.appendChild(Dom.new('<span> — </span>')[0])
|
|
176
|
-
|
|
177
179
|
const textWidth = this.elements.$item.offsetWidth
|
|
178
180
|
if (textWidth) {
|
|
181
|
+
if (this.opts.spacer) {
|
|
182
|
+
this.elements.$holder.appendChild(Dom.new(this.opts.spacer)[0])
|
|
183
|
+
}
|
|
179
184
|
const count = Math.max(Math.ceil(this.app.size.width / textWidth) - 1, 2)
|
|
180
|
-
|
|
185
|
+
|
|
181
186
|
for (let i = 0; i < count; i += 1) {
|
|
182
187
|
this.elements.$holder.append(this.elements.$item.cloneNode(true))
|
|
183
|
-
this.
|
|
188
|
+
if (this.opts.spacer) {
|
|
189
|
+
this.elements.$holder.appendChild(Dom.new(this.opts.spacer)[0])
|
|
190
|
+
}
|
|
184
191
|
}
|
|
185
|
-
|
|
192
|
+
|
|
186
193
|
this.elements.$marquee.appendChild(this.elements.$holder.cloneNode(true))
|
|
187
194
|
} else {
|
|
188
|
-
console.error(
|
|
195
|
+
console.error(
|
|
196
|
+
'no textWidth! probably image? Set width to elements inside holder',
|
|
197
|
+
this.elements.$item
|
|
198
|
+
)
|
|
189
199
|
}
|
|
190
200
|
}
|
|
191
201
|
|
|
192
|
-
setHeight
|
|
202
|
+
setHeight() {
|
|
193
203
|
const height = this.elements.$item.offsetHeight + this.opts.extraHeight
|
|
194
204
|
gsap.set(this.elements.$el, { height })
|
|
195
205
|
}
|
|
@@ -17,47 +17,70 @@ const DEFAULT_OPTIONS = {
|
|
|
17
17
|
document.body.classList.toggle('open-menu')
|
|
18
18
|
|
|
19
19
|
timeline
|
|
20
|
-
.fromTo(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
.fromTo(
|
|
21
|
+
m.bg,
|
|
22
|
+
{
|
|
23
|
+
duration: 0.35,
|
|
24
|
+
x: '0%',
|
|
25
|
+
opacity: 0,
|
|
26
|
+
height: window.innerHeight
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
duration: 0.35,
|
|
30
|
+
opacity: 1,
|
|
31
|
+
ease: 'sine.in'
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
.to(
|
|
35
|
+
m.logo,
|
|
36
|
+
{
|
|
37
|
+
duration: 0.35,
|
|
38
|
+
opacity: 0,
|
|
39
|
+
ease: 'power3.out'
|
|
40
|
+
},
|
|
41
|
+
'-=0.35'
|
|
42
|
+
)
|
|
43
|
+
.to(
|
|
44
|
+
m.header,
|
|
45
|
+
{
|
|
46
|
+
duration: 0.55,
|
|
47
|
+
backgroundColor: 'transparent',
|
|
48
|
+
ease: 'power3.out'
|
|
49
|
+
},
|
|
50
|
+
'-=0.35'
|
|
51
|
+
)
|
|
52
|
+
.call(() => {
|
|
53
|
+
m.nav.style.gridTemplateRows = 'auto 1fr'
|
|
29
54
|
})
|
|
30
|
-
.to(m.logo, {
|
|
31
|
-
duration: 0.35,
|
|
32
|
-
opacity: 0,
|
|
33
|
-
ease: 'power3.out'
|
|
34
|
-
}, '-=0.35')
|
|
35
|
-
.to(m.header, {
|
|
36
|
-
duration: 0.55,
|
|
37
|
-
backgroundColor: 'transparent',
|
|
38
|
-
ease: 'power3.out'
|
|
39
|
-
}, '-=0.35')
|
|
40
|
-
.call(() => { m.nav.style.gridTemplateRows = 'auto 1fr' })
|
|
41
55
|
.set(m.nav, { height: window.innerHeight })
|
|
42
56
|
.set(m.content, { display: 'block' })
|
|
43
57
|
.set(m.logoPath, { fill: m.opts.logoColor })
|
|
44
58
|
.set(m.logo, { xPercent: 3 })
|
|
45
|
-
.staggerFromTo(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
.staggerFromTo(
|
|
60
|
+
m.lis,
|
|
61
|
+
{
|
|
62
|
+
duration: 1,
|
|
63
|
+
opacity: 0,
|
|
64
|
+
x: 20
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
duration: 1,
|
|
68
|
+
x: 0,
|
|
69
|
+
opacity: 1,
|
|
70
|
+
ease: 'power3.out'
|
|
71
|
+
},
|
|
72
|
+
0.05
|
|
73
|
+
)
|
|
74
|
+
.to(
|
|
75
|
+
m.logo,
|
|
76
|
+
{
|
|
77
|
+
duration: 0.55,
|
|
78
|
+
opacity: 1,
|
|
79
|
+
xPercent: 0,
|
|
80
|
+
ease: 'power3.inOut'
|
|
81
|
+
},
|
|
82
|
+
'-=1.2'
|
|
83
|
+
)
|
|
61
84
|
.call(m._emitMobileMenuOpenEvent)
|
|
62
85
|
},
|
|
63
86
|
|
|
@@ -66,31 +89,51 @@ const DEFAULT_OPTIONS = {
|
|
|
66
89
|
const timeline = gsap.timeline()
|
|
67
90
|
|
|
68
91
|
timeline
|
|
69
|
-
.call(() => {
|
|
70
|
-
|
|
71
|
-
duration: 0.2,
|
|
72
|
-
opacity: 1,
|
|
73
|
-
xPercent: 0
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
duration: 0.2,
|
|
77
|
-
opacity: 0,
|
|
78
|
-
xPercent: 5,
|
|
79
|
-
ease: 'power3.out'
|
|
92
|
+
.call(() => {
|
|
93
|
+
m.hamburger.classList.toggle('is-active')
|
|
80
94
|
})
|
|
95
|
+
.fromTo(
|
|
96
|
+
m.logo,
|
|
97
|
+
{
|
|
98
|
+
duration: 0.2,
|
|
99
|
+
opacity: 1,
|
|
100
|
+
xPercent: 0
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
duration: 0.2,
|
|
104
|
+
opacity: 0,
|
|
105
|
+
xPercent: 5,
|
|
106
|
+
ease: 'power3.out'
|
|
107
|
+
}
|
|
108
|
+
)
|
|
81
109
|
.set(m.logoPath, { clearProps: 'fill' })
|
|
82
|
-
.staggerTo(
|
|
83
|
-
|
|
84
|
-
|
|
110
|
+
.staggerTo(
|
|
111
|
+
m.lis,
|
|
112
|
+
{
|
|
113
|
+
duration: 0.5,
|
|
114
|
+
opacity: 0,
|
|
115
|
+
x: 20,
|
|
116
|
+
ease: 'power3.out'
|
|
117
|
+
},
|
|
118
|
+
0.04
|
|
119
|
+
)
|
|
85
120
|
.set(m.nav, { clearProps: 'height' })
|
|
86
|
-
.to(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
121
|
+
.to(
|
|
122
|
+
m.bg,
|
|
123
|
+
{
|
|
124
|
+
duration: 0.25,
|
|
125
|
+
x: '100%',
|
|
126
|
+
ease: 'sine.in'
|
|
127
|
+
},
|
|
128
|
+
'-=0.3'
|
|
129
|
+
)
|
|
130
|
+
.call(() => {
|
|
131
|
+
m._emitMobileMenuClosedEvent()
|
|
132
|
+
})
|
|
92
133
|
.set(m.content, { display: 'none' })
|
|
93
|
-
.call(() => {
|
|
134
|
+
.call(() => {
|
|
135
|
+
m.nav.style.gridTemplateRows = 'auto'
|
|
136
|
+
})
|
|
94
137
|
.set(m.lis, { clearProps: 'opacity' })
|
|
95
138
|
.to(m.logo, {
|
|
96
139
|
duration: 0.35,
|
|
@@ -101,7 +144,7 @@ const DEFAULT_OPTIONS = {
|
|
|
101
144
|
}
|
|
102
145
|
|
|
103
146
|
export default class MobileMenu {
|
|
104
|
-
constructor
|
|
147
|
+
constructor(app, opts = {}) {
|
|
105
148
|
this.app = app
|
|
106
149
|
this.opts = _defaultsDeep(opts, DEFAULT_OPTIONS)
|
|
107
150
|
|
|
@@ -112,7 +155,9 @@ export default class MobileMenu {
|
|
|
112
155
|
this.logoPath = this.logo ? this.logo.querySelectorAll(this.opts.logoPathSelector) : null
|
|
113
156
|
this.menuButton = this.header.querySelector('figure.menu-button')
|
|
114
157
|
this.hamburger = this.menuButton ? this.menuButton.querySelector('.hamburger') : null
|
|
115
|
-
this.hamburgerInner = this.menuButton
|
|
158
|
+
this.hamburgerInner = this.menuButton
|
|
159
|
+
? this.menuButton.querySelector('.hamburger-inner')
|
|
160
|
+
: null
|
|
116
161
|
this.content = this.header.querySelectorAll(this.opts.contentSelector)
|
|
117
162
|
this.lis = this.header.querySelectorAll(this.opts.liSelector)
|
|
118
163
|
this.nav = this.header.querySelector('nav')
|
|
@@ -126,11 +171,13 @@ export default class MobileMenu {
|
|
|
126
171
|
}
|
|
127
172
|
|
|
128
173
|
if (this.opts.onResize) {
|
|
129
|
-
window.addEventListener(Events.APPLICATION_RESIZE, () => {
|
|
174
|
+
window.addEventListener(Events.APPLICATION_RESIZE, () => {
|
|
175
|
+
this.opts.onResize(this)
|
|
176
|
+
})
|
|
130
177
|
}
|
|
131
178
|
}
|
|
132
179
|
|
|
133
|
-
toggleMenu
|
|
180
|
+
toggleMenu() {
|
|
134
181
|
if (document.body.classList.contains('open-menu')) {
|
|
135
182
|
this.toggleMenuClosed()
|
|
136
183
|
} else {
|
|
@@ -138,24 +185,24 @@ export default class MobileMenu {
|
|
|
138
185
|
}
|
|
139
186
|
}
|
|
140
187
|
|
|
141
|
-
toggleMenuClosed
|
|
188
|
+
toggleMenuClosed() {
|
|
142
189
|
// CLOSING MENU
|
|
143
190
|
this.opts.closeTween(this)
|
|
144
191
|
this.open = false
|
|
145
192
|
}
|
|
146
193
|
|
|
147
|
-
toggleMenuOpen
|
|
194
|
+
toggleMenuOpen() {
|
|
148
195
|
// OPENING MENU
|
|
149
196
|
this.opts.openTween(this)
|
|
150
197
|
this.open = true
|
|
151
198
|
}
|
|
152
199
|
|
|
153
|
-
_emitMobileMenuOpenEvent
|
|
200
|
+
_emitMobileMenuOpenEvent() {
|
|
154
201
|
const mobileMenuOpenEvent = new window.CustomEvent(Events.APPLICATION_MOBILE_MENU_OPEN)
|
|
155
202
|
window.dispatchEvent(mobileMenuOpenEvent)
|
|
156
203
|
}
|
|
157
204
|
|
|
158
|
-
_emitMobileMenuClosedEvent
|
|
205
|
+
_emitMobileMenuClosedEvent() {
|
|
159
206
|
const mobileMenuClosedEvent = new window.CustomEvent(Events.APPLICATION_MOBILE_MENU_CLOSED)
|
|
160
207
|
window.dispatchEvent(mobileMenuClosedEvent)
|
|
161
208
|
}
|