@brandocms/jupiter 3.46.4 → 3.47.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
CHANGED
package/src/index.js
CHANGED
|
@@ -15,6 +15,7 @@ import Cookies from './modules/Cookies'
|
|
|
15
15
|
import CoverOverlay from './modules/CoverOverlay'
|
|
16
16
|
import Dom from './modules/Dom'
|
|
17
17
|
import Dropdown from './modules/Dropdown'
|
|
18
|
+
import EqualHeightImages from './modules/EqualHeightImages'
|
|
18
19
|
import * as Events from './events'
|
|
19
20
|
import FixedHeader from './modules/FixedHeader'
|
|
20
21
|
import FooterReveal from './modules/FooterReveal'
|
|
@@ -48,6 +49,7 @@ export {
|
|
|
48
49
|
Dom,
|
|
49
50
|
Draggable,
|
|
50
51
|
Dropdown,
|
|
52
|
+
EqualHeightImages,
|
|
51
53
|
Events,
|
|
52
54
|
FixedHeader,
|
|
53
55
|
FooterReveal,
|
|
@@ -25,9 +25,15 @@ window.onpageshow = event => {
|
|
|
25
25
|
gsap.to(dataFaders, { duration: 0.35, autoAlpha: 0 })
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
gsap.set(document.body, {
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
gsap.set(document.body, { clearProps: 'opacity' })
|
|
29
|
+
|
|
30
|
+
// check that navigation is visible
|
|
31
|
+
const $nav = Dom.find('header[data-nav]')
|
|
32
|
+
gsap.set($nav, { clearProps: 'opacity' })
|
|
33
|
+
|
|
34
|
+
// check that footer is visible
|
|
35
|
+
const $footer = Dom.find('footer')
|
|
36
|
+
gsap.set($footer, { clearProps: 'opacity' })
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { gsap } from 'gsap'
|
|
2
|
+
import Dom from '../Dom'
|
|
3
|
+
import imagesAreLoaded from '../../utils/imagesAreLoaded'
|
|
4
|
+
|
|
5
|
+
export default class EqualHeightImages {
|
|
6
|
+
constructor (app) {
|
|
7
|
+
this.app = app
|
|
8
|
+
this.initialize()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
initialize () {
|
|
12
|
+
const canvases = Dom.all('[data-eq-height-images]')
|
|
13
|
+
Array.from(canvases).forEach(canvas => {
|
|
14
|
+
// if (app.breakpoints.mediaQueries.iphone.matches || app.breakpoints.mediaQueries.mobile.matches) {
|
|
15
|
+
// return
|
|
16
|
+
// }
|
|
17
|
+
let lastTop = null
|
|
18
|
+
const actionables = []
|
|
19
|
+
let elements = []
|
|
20
|
+
let height = 0
|
|
21
|
+
const imgs = Dom.all(canvas, 'img')
|
|
22
|
+
|
|
23
|
+
imagesAreLoaded(imgs, false).then(() => {
|
|
24
|
+
imgs.forEach(el => {
|
|
25
|
+
const rect = el.getBoundingClientRect()
|
|
26
|
+
const size = this.getImgSizeInfo(el)
|
|
27
|
+
|
|
28
|
+
console.log('go')
|
|
29
|
+
|
|
30
|
+
if (lastTop === null) {
|
|
31
|
+
height = size.height
|
|
32
|
+
elements.push(el)
|
|
33
|
+
lastTop = rect.top
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (lastTop !== rect.top) {
|
|
38
|
+
actionables.push({ elements, height })
|
|
39
|
+
elements = []
|
|
40
|
+
height = size.height
|
|
41
|
+
} else if (lastTop === rect.top) {
|
|
42
|
+
if (size.height > height) {
|
|
43
|
+
height = size.height
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
height = size.height
|
|
47
|
+
}
|
|
48
|
+
elements.push(el)
|
|
49
|
+
lastTop = rect.top
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
if (elements.length) {
|
|
53
|
+
actionables.push({ elements, height })
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (actionables.length) {
|
|
57
|
+
actionables.forEach(a => {
|
|
58
|
+
gsap.set(a.elements, { minHeight: a.height })
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
getRenderedSize (contains, cWidth, cHeight, width, height, pos) {
|
|
66
|
+
const oRatio = width / height
|
|
67
|
+
const cRatio = cWidth / cHeight
|
|
68
|
+
// eslint-disable-next-line func-names
|
|
69
|
+
return function () {
|
|
70
|
+
if (contains ? (oRatio > cRatio) : (oRatio < cRatio)) {
|
|
71
|
+
this.width = cWidth
|
|
72
|
+
this.height = cWidth / oRatio
|
|
73
|
+
} else {
|
|
74
|
+
this.width = cHeight * oRatio
|
|
75
|
+
this.height = cHeight
|
|
76
|
+
}
|
|
77
|
+
this.left = (cWidth - this.width) * (pos / 100)
|
|
78
|
+
this.right = this.width + this.left
|
|
79
|
+
return this
|
|
80
|
+
}.call({})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
getImgSizeInfo (img) {
|
|
84
|
+
const pos = window
|
|
85
|
+
.getComputedStyle(img)
|
|
86
|
+
.getPropertyValue('object-position')
|
|
87
|
+
.split(' ')
|
|
88
|
+
|
|
89
|
+
return this.getRenderedSize(true,
|
|
90
|
+
img.width,
|
|
91
|
+
img.height,
|
|
92
|
+
img.naturalWidth,
|
|
93
|
+
img.naturalHeight,
|
|
94
|
+
parseInt(pos[0]))
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -8,6 +8,7 @@ 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
14
|
gsap.to(marqueeEl, { opacity: 1 })
|
|
@@ -172,20 +173,23 @@ export default class Marquee {
|
|
|
172
173
|
this.elements.$holder.innerHTML = ''
|
|
173
174
|
this.elements.$holder.appendChild(this.elements.$item)
|
|
174
175
|
|
|
175
|
-
this.elements.$holder.appendChild(Dom.new('<span> — </span>')[0])
|
|
176
|
-
|
|
177
176
|
const textWidth = this.elements.$item.offsetWidth
|
|
178
177
|
if (textWidth) {
|
|
178
|
+
if (this.opts.spacer) {
|
|
179
|
+
this.elements.$holder.appendChild(Dom.new(this.opts.spacer)[0])
|
|
180
|
+
}
|
|
179
181
|
const count = Math.max(Math.ceil(this.app.size.width / textWidth) - 1, 2)
|
|
180
182
|
|
|
181
183
|
for (let i = 0; i < count; i += 1) {
|
|
182
184
|
this.elements.$holder.append(this.elements.$item.cloneNode(true))
|
|
183
|
-
this.
|
|
185
|
+
if (this.opts.spacer) {
|
|
186
|
+
this.elements.$holder.appendChild(Dom.new(this.opts.spacer)[0])
|
|
187
|
+
}
|
|
184
188
|
}
|
|
185
189
|
|
|
186
190
|
this.elements.$marquee.appendChild(this.elements.$holder.cloneNode(true))
|
|
187
191
|
} else {
|
|
188
|
-
console.error('no textWidth! probably image?', this.elements.$item)
|
|
192
|
+
console.error('no textWidth! probably image? Set width to elements inside holder', this.elements.$item)
|
|
189
193
|
}
|
|
190
194
|
}
|
|
191
195
|
|