@brandocms/jupiter 3.42.7 → 3.43.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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
#### 3.43.0
|
|
2
|
+
|
|
3
|
+
- **BREAKING** Marquee: More consistent `speed`. This means you should probably
|
|
4
|
+
verify that the speed you set looks ok with the new config
|
|
5
|
+
- Marquee: Add `paddingLeft` and `slowDownOnHover` options
|
|
6
|
+
- Application: send `widthChanged` and `heightChanged` booleans
|
|
7
|
+
in `APPLICATION:RESIZE` event detail
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
#### 3.42.7
|
|
2
11
|
|
|
3
12
|
- Links: Check for zero opacity body element on back/forward nav
|
package/package.json
CHANGED
|
@@ -507,12 +507,15 @@ export default class Application {
|
|
|
507
507
|
* RAF'ed resize event
|
|
508
508
|
*/
|
|
509
509
|
onResize (e) {
|
|
510
|
+
const widthChanged = (this.size.width !== window.innerWidth)
|
|
511
|
+
const heightChanged = (this.size.height !== window.innerHeight)
|
|
512
|
+
|
|
510
513
|
this.size.width = window.innerWidth
|
|
511
514
|
this.size.height = window.innerHeight
|
|
512
515
|
this.setvh100()
|
|
513
516
|
this.updateZoom()
|
|
514
517
|
|
|
515
|
-
const evt = new CustomEvent(Events.APPLICATION_RESIZE,
|
|
518
|
+
const evt = new CustomEvent(Events.APPLICATION_RESIZE, { detail: { widthChanged, heightChanged } })
|
|
516
519
|
window.dispatchEvent(evt)
|
|
517
520
|
}
|
|
518
521
|
|
|
@@ -3,8 +3,10 @@ import _defaultsDeep from 'lodash.defaultsdeep'
|
|
|
3
3
|
import Dom from '../Dom'
|
|
4
4
|
|
|
5
5
|
const DEFAULT_OPTIONS = {
|
|
6
|
-
speed:
|
|
7
|
-
extraHeight: 0
|
|
6
|
+
speed: 100,
|
|
7
|
+
extraHeight: 0,
|
|
8
|
+
slowDownOnHover: true,
|
|
9
|
+
paddingLeft: 0
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
export default class Marquee {
|
|
@@ -26,18 +28,29 @@ export default class Marquee {
|
|
|
26
28
|
window.addEventListener('APPLICATION:RESIZE', this.updateMarquee.bind(this))
|
|
27
29
|
this.updateMarquee()
|
|
28
30
|
this.setupObserver()
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
if (this.opts.slowDownOnHover) {
|
|
32
|
+
this.elements.$el.addEventListener('mouseenter', this.slowDown.bind(this))
|
|
33
|
+
this.elements.$el.addEventListener('mouseleave', this.speedUp.bind(this))
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
|
|
33
|
-
updateMarquee () {
|
|
37
|
+
updateMarquee (e) {
|
|
38
|
+
if (e) {
|
|
39
|
+
// updating cause of a resize. we only care about width change
|
|
40
|
+
if (!e.detail.widthChanged) {
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
}
|
|
34
44
|
this.killTweens()
|
|
35
45
|
this.clearHolders()
|
|
36
46
|
this.setHeight()
|
|
37
47
|
this.fillText()
|
|
48
|
+
|
|
38
49
|
const holderWidth = this.elements.$holder.offsetWidth
|
|
39
50
|
const $allHolders = Dom.all(this.elements.$el, '[data-marquee-holder]')
|
|
40
51
|
const marqueeWidth = holderWidth * $allHolders.length
|
|
52
|
+
|
|
53
|
+
this.duration = holderWidth / this.opts.speed
|
|
41
54
|
|
|
42
55
|
gsap.set(this.elements.$marquee, { width: marqueeWidth })
|
|
43
56
|
this.initializeTween()
|
|
@@ -68,7 +81,7 @@ export default class Marquee {
|
|
|
68
81
|
|
|
69
82
|
this.timeline = gsap.timeline({ paused: true })
|
|
70
83
|
this.timeline
|
|
71
|
-
.to($allHolders,
|
|
84
|
+
.to($allHolders, { xPercent: -100, ease: 'none', duration: this.duration })
|
|
72
85
|
.repeat(-1)
|
|
73
86
|
|
|
74
87
|
window.timeline = this.timeline
|