@foeewni/web-core 3.0.0-alpha.13 → 3.0.0-alpha.15
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/dist/css/foe.critical.min.css +7 -7
- package/dist/css/foe.main.min.css +1 -1
- package/dist/js/foe.critical.min.js +1 -1
- package/dist/js/foe.extras.min.js +1 -1
- package/dist/js/foe.fonts.min.js +1 -1
- package/dist/js/foe.main.min.js +1 -1
- package/package.json +1 -1
- package/src/components/form/buttons.scss +1 -0
- package/src/components/hero-panel/style.scss +29 -1
- package/src/components/layout/backgrounds.scss +20 -1
- package/src/components/navigation/_header.scss +29 -8
- package/src/components/navigation/_mega-menu.scss +89 -0
- package/src/components/navigation/_nav-items.scss +101 -13
- package/src/components/navigation/defocus.js +30 -0
- package/src/components/navigation/index.js +1 -0
- package/src/components/tools/jaunty.js +29 -41
- package/src/components/typography/display.scss +2 -2
|
@@ -265,9 +265,37 @@ The parallax effect needs the file `foe.components.js` to be appended in the pag
|
|
|
265
265
|
|
|
266
266
|
span {
|
|
267
267
|
background: $foe-primary;
|
|
268
|
-
|
|
268
|
+
border: $foe-primary $spacer solid;
|
|
269
|
+
border-left: 0;
|
|
269
270
|
display: inline;
|
|
270
271
|
border-color: transparent;
|
|
272
|
+
line-height: 6rem;
|
|
273
|
+
white-space: pre-wrap;
|
|
274
|
+
position: relative;
|
|
275
|
+
|
|
276
|
+
@include media-breakpoint-down(md) {
|
|
277
|
+
line-height: 4rem;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
&::before {
|
|
281
|
+
content: '';
|
|
282
|
+
position: absolute;
|
|
283
|
+
top: -$spacer * .95;
|
|
284
|
+
right: 100%;
|
|
285
|
+
bottom: -$spacer * .95;
|
|
286
|
+
width: 1rem;
|
|
287
|
+
background-color: #61bdaa;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
&[data-jaunt-factor] {
|
|
291
|
+
border: none;
|
|
292
|
+
border-color: $foe-primary;
|
|
293
|
+
padding: $spacer;
|
|
294
|
+
|
|
295
|
+
&::before {
|
|
296
|
+
display: none;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
271
299
|
}
|
|
272
300
|
}
|
|
273
301
|
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.bg-primary
|
|
34
|
+
.bg-primary,
|
|
35
|
+
.bg-secondary {
|
|
35
36
|
background-color: $foe-leaf-75 !important;
|
|
36
37
|
|
|
37
38
|
@include heading_colours($foe-extradark, $foe-extradark);
|
|
@@ -83,3 +84,21 @@
|
|
|
83
84
|
@include button-outline-variant($foe-offwhite);
|
|
84
85
|
}
|
|
85
86
|
}
|
|
87
|
+
|
|
88
|
+
.bg-light,
|
|
89
|
+
.bg-white {
|
|
90
|
+
background-color: $foe-offwhite !important;
|
|
91
|
+
|
|
92
|
+
@include heading_colours($foe-accent, $foe-accent);
|
|
93
|
+
@include text_colours($foe-accent, $foe-accent);
|
|
94
|
+
|
|
95
|
+
.btn-primary,
|
|
96
|
+
.foe-cta {
|
|
97
|
+
@include button-variant($foe-accent, $foe-accent);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.btn-outline-primary,
|
|
101
|
+
.btn-secondary {
|
|
102
|
+
@include button-outline-variant($foe-accent);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -13,15 +13,22 @@
|
|
|
13
13
|
padding: 0;
|
|
14
14
|
z-index: $zindex-navbar !important;
|
|
15
15
|
background-color: $foe-leaf-75;
|
|
16
|
+
color: $foe-extradark;
|
|
16
17
|
transition:
|
|
17
18
|
background-color $foe-transition-duration-base $foe-transition-easing,
|
|
18
19
|
background-position $foe-transition-duration-base $foe-transition-easing,
|
|
19
20
|
box-shadow $foe-transition-duration-base $foe-transition-easing,
|
|
20
21
|
padding $foe-transition-duration-base $foe-transition-easing;
|
|
21
22
|
|
|
23
|
+
.navbar-toggler {
|
|
24
|
+
.icon-close,
|
|
25
|
+
.icon-bar {
|
|
26
|
+
background-color: $foe-extradark;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
&.js-menustack {
|
|
23
31
|
position: fixed;
|
|
24
|
-
color: $foe-offwhite;
|
|
25
32
|
z-index: $zindex-navbar + 10 !important;
|
|
26
33
|
|
|
27
34
|
// Scrolled state
|
|
@@ -62,13 +69,6 @@
|
|
|
62
69
|
right: 0;
|
|
63
70
|
}
|
|
64
71
|
|
|
65
|
-
@include media-breakpoint-down(md) {
|
|
66
|
-
padding-left: calc($grid-gutter-width / 2) !important;
|
|
67
|
-
padding-right: calc($grid-gutter-width / 2) !important;
|
|
68
|
-
// #13294 Fixing the mobile navigation (with overflow:hidden the mobile search does not display below the navigation)
|
|
69
|
-
// overflow: hidden;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
72
|
// Scrolled state
|
|
73
73
|
&.js-menustack-stuck {
|
|
74
74
|
padding: 0;
|
|
@@ -77,5 +77,26 @@
|
|
|
77
77
|
body.foe-page-has-campaign-nav & {
|
|
78
78
|
box-shadow: none;
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
@include media-breakpoint-up(lg) {
|
|
82
|
+
.foe-nav-cta a {
|
|
83
|
+
@include margin-vertical-align($foe-nav-height-large-scrolled, $foe-nav-cta-height-large);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
ul.navbar-nav > li > a {
|
|
87
|
+
line-height: $foe-nav-height-large-scrolled;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.skip-link:focus-within + * &.js-menustack {
|
|
93
|
+
top: 1.5rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@include media-breakpoint-down(md) {
|
|
97
|
+
padding-left: calc($grid-gutter-width / 2) !important;
|
|
98
|
+
padding-right: calc($grid-gutter-width / 2) !important;
|
|
99
|
+
// #13294 Fixing the mobile navigation (with overflow:hidden the mobile search does not display below the navigation)
|
|
100
|
+
// overflow: hidden;
|
|
80
101
|
}
|
|
81
102
|
}
|
|
@@ -17,10 +17,22 @@
|
|
|
17
17
|
visibility 0s $foe-transition-easing $foe-transition-duration-base,
|
|
18
18
|
opacity $foe-transition-duration-base $foe-transition-easing;
|
|
19
19
|
|
|
20
|
+
@include media-breakpoint-up(lg) { // Megamenus are only applicable on larger viewports. They appear as a list on smaller screens
|
|
21
|
+
display: block;
|
|
22
|
+
padding-top: $foe-submenu-margin;
|
|
23
|
+
padding-bottom: $foe-submenu-margin;
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
@include media-breakpoint-up(md) { // Megamenus are only applicable on larger viewports.
|
|
21
27
|
display: block;
|
|
22
28
|
}
|
|
23
29
|
|
|
30
|
+
> .container {
|
|
31
|
+
@include media-breakpoint-up(md) {
|
|
32
|
+
justify-content: flex-end;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
&.megamenu-search { // Allow the search "megamenu" to persist at smaller breakpoints
|
|
25
37
|
@include media-breakpoint-up(sm) {
|
|
26
38
|
display: block;
|
|
@@ -40,6 +52,10 @@
|
|
|
40
52
|
|
|
41
53
|
> .container > .row {
|
|
42
54
|
width: 100%;
|
|
55
|
+
|
|
56
|
+
@include media-breakpoint-up(md) {
|
|
57
|
+
justify-content: flex-end;
|
|
58
|
+
}
|
|
43
59
|
}
|
|
44
60
|
}
|
|
45
61
|
|
|
@@ -181,3 +197,76 @@
|
|
|
181
197
|
}
|
|
182
198
|
}
|
|
183
199
|
}
|
|
200
|
+
|
|
201
|
+
ul.navbar-nav.menu-main {
|
|
202
|
+
.foe-mega-menu {
|
|
203
|
+
.submenu-block {
|
|
204
|
+
ul.sub-megamenu-first {
|
|
205
|
+
column-gap: 0;
|
|
206
|
+
overflow: hidden;
|
|
207
|
+
height: auto; /* $foe-submenu-tile-height; */
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-direction: column;
|
|
210
|
+
list-style: none;
|
|
211
|
+
padding-left: .5rem;
|
|
212
|
+
padding-bottom: .5rem;
|
|
213
|
+
|
|
214
|
+
@include media-breakpoint-up(lg) {
|
|
215
|
+
align-items: end;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
> li {
|
|
219
|
+
&.sub-item {
|
|
220
|
+
width: 100%;
|
|
221
|
+
padding: .125rem;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
> span {
|
|
225
|
+
line-height: calc($foe-submenu-tile-height / 4);
|
|
226
|
+
font-weight: 500;
|
|
227
|
+
color: $foe-gray;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
> a {
|
|
231
|
+
line-height: calc($foe-submenu-tile-height / 4 - 0.4rem);
|
|
232
|
+
font-weight: 600;
|
|
233
|
+
color: $foe-extradark;
|
|
234
|
+
transition: color 400ms ease-in-out;
|
|
235
|
+
|
|
236
|
+
@include media-breakpoint-up(md) {
|
|
237
|
+
padding-right: 0;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
&:hover {
|
|
241
|
+
color: $foe-extradark;
|
|
242
|
+
box-shadow: none;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
ul.sub-megamenu-below {
|
|
247
|
+
padding-left: 0;
|
|
248
|
+
display: flex;
|
|
249
|
+
flex-direction: column;
|
|
250
|
+
|
|
251
|
+
@include media-breakpoint-down(md) {
|
|
252
|
+
display: none;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
li.sub-item {
|
|
256
|
+
a {
|
|
257
|
+
color: $foe-text;
|
|
258
|
+
font-weight: 500;
|
|
259
|
+
line-height: 1.8rem;
|
|
260
|
+
|
|
261
|
+
&:hover {
|
|
262
|
+
color: $foe-extradark;
|
|
263
|
+
box-shadow: none;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
@@ -38,11 +38,6 @@
|
|
|
38
38
|
display: block;
|
|
39
39
|
color: $foe-extradark;
|
|
40
40
|
text-decoration: none;
|
|
41
|
-
box-shadow: inset 0 0 0 0 $foe-accent;
|
|
42
|
-
transition:
|
|
43
|
-
color $foe-transition-duration-base ease-in-out,
|
|
44
|
-
box-shadow $foe-transition-duration-base ease-in-out;
|
|
45
|
-
// transition: line-height $foe-transition-duration-base $foe-transition-easing, color $foe-transition-duration-base $foe-transition-easing;
|
|
46
41
|
|
|
47
42
|
@include media-breakpoint-up(lg) {
|
|
48
43
|
padding: 0 18px;
|
|
@@ -58,7 +53,6 @@
|
|
|
58
53
|
|
|
59
54
|
&:hover {
|
|
60
55
|
color: $foe-offwhite;
|
|
61
|
-
box-shadow: inset 10rem 0 0 0 $foe-accent;
|
|
62
56
|
text-decoration: none;
|
|
63
57
|
}
|
|
64
58
|
}
|
|
@@ -90,16 +84,110 @@
|
|
|
90
84
|
}
|
|
91
85
|
}
|
|
92
86
|
}
|
|
93
|
-
}
|
|
94
87
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
88
|
+
> li {
|
|
89
|
+
> a {
|
|
90
|
+
background: linear-gradient(90deg, $foe-accent 0%, $foe-accent 50%, transparent 50%, transparent 100%);
|
|
91
|
+
background-size: 200% 100%;
|
|
92
|
+
background-position: 101% 50%;
|
|
93
|
+
background-repeat: no-repeat;
|
|
94
|
+
transition:
|
|
95
|
+
color $foe-transition-duration-base ease-in-out,
|
|
96
|
+
background-position $foe-transition-duration-base ease-in-out;
|
|
97
|
+
|
|
98
|
+
&:hover {
|
|
99
|
+
background-position: 0% 50%;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.menu-main {
|
|
105
|
+
display: block;
|
|
106
|
+
width: auto;
|
|
107
|
+
float: right;
|
|
108
|
+
padding: 0;
|
|
109
|
+
line-height: 4rem;
|
|
110
|
+
|
|
111
|
+
@include media-breakpoint-down(md) {
|
|
112
|
+
width: 100%;
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
// #13294 this should be covered by the styles on web-core 3.0.0
|
|
115
|
+
transition: max-height $foe-transition-duration-base*2 $foe-transition-easing;
|
|
99
116
|
}
|
|
100
117
|
|
|
101
|
-
|
|
102
|
-
|
|
118
|
+
li.foe-has-megamenu {
|
|
119
|
+
&:focus-within,
|
|
120
|
+
&:hover {
|
|
121
|
+
.foe-megamenu-container {
|
|
122
|
+
display: block;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
a + .open-megamenu {
|
|
126
|
+
&::after {
|
|
127
|
+
transform: rotate(45deg);
|
|
128
|
+
-webkit-transform: rotate(45deg);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
div.foe-megamenu-container {
|
|
134
|
+
&.collapsed {
|
|
135
|
+
display: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
&.un-collapsed {
|
|
139
|
+
opacity: 1;
|
|
140
|
+
visibility: visible;
|
|
141
|
+
display: block;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@include media-breakpoint-down(md) {
|
|
146
|
+
a {
|
|
147
|
+
display: inline-block;
|
|
148
|
+
|
|
149
|
+
&.is-active {
|
|
150
|
+
&::after {
|
|
151
|
+
transform: rotate(45deg);
|
|
152
|
+
-webkit-transform: rotate(45deg);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
& + .open-megamenu {
|
|
157
|
+
padding: 1rem;
|
|
158
|
+
|
|
159
|
+
&::after {
|
|
160
|
+
position: relative;
|
|
161
|
+
content: '';
|
|
162
|
+
opacity: 1;
|
|
163
|
+
border: solid $foe-extradark;
|
|
164
|
+
border-width: 0 3px 3px 0;
|
|
165
|
+
display: inline-block;
|
|
166
|
+
padding: 3px;
|
|
167
|
+
transform: rotate(-45deg);
|
|
168
|
+
-webkit-transform: rotate(-45deg);
|
|
169
|
+
margin-left: .5rem;
|
|
170
|
+
left: 0;
|
|
171
|
+
bottom: .05rem;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
div.foe-megamenu-container { /* just for mobile menu */
|
|
177
|
+
position: relative;
|
|
178
|
+
background-color: transparent;
|
|
179
|
+
box-shadow: none;
|
|
180
|
+
|
|
181
|
+
li.foe-has-megamenu {
|
|
182
|
+
&:focus-within,
|
|
183
|
+
&:hover {
|
|
184
|
+
.foe-megamenu-container {
|
|
185
|
+
display: block;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
103
191
|
}
|
|
104
192
|
}
|
|
105
193
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is introduced to overcome the :focus-within styles on the mega menu remaining open when ctrl-clicking a navigation link.
|
|
3
|
+
* The mega menu styles hold the menu open when a link is focused on so that a keyboard user can navigate through.
|
|
4
|
+
* However if you click on the link element it gains the focus state but as it's opening an external window/tab so
|
|
5
|
+
* the focus remains and mousing out of the menu doesn't close it. This snippet removes the focus state when something
|
|
6
|
+
* is clicked on wit the ctrl key on clicked on with a middle mouse button.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
(() => {
|
|
10
|
+
const DeFocus = {
|
|
11
|
+
init: () => {
|
|
12
|
+
document.addEventListener('click', (e) => {
|
|
13
|
+
// ctrl click for openning in a new tab
|
|
14
|
+
if (e.ctrlKey) {
|
|
15
|
+
DeFocus.removeFocus();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
document.addEventListener('auxclick', (e) => {
|
|
19
|
+
// middle button click
|
|
20
|
+
if (e.button === 1) {
|
|
21
|
+
DeFocus.removeFocus();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
removeFocus: () => {
|
|
26
|
+
document.querySelectorAll(':focus').forEach(element => element.blur());
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
window.addEventListener('DOMContentLoaded', DeFocus.init);
|
|
30
|
+
})();
|
|
@@ -53,10 +53,10 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
|
|
|
53
53
|
context.stroke();
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
const jauntTarget = (target
|
|
56
|
+
const jauntTarget = (target) => {
|
|
57
57
|
if (
|
|
58
|
-
!target.firstChild
|
|
59
|
-
target.firstChild.nodeType !== Node.TEXT_NODE
|
|
58
|
+
!target.firstChild
|
|
59
|
+
|| target.firstChild.nodeType !== Node.TEXT_NODE
|
|
60
60
|
) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
@@ -74,12 +74,6 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
|
|
|
74
74
|
const targetBox = target.getBoundingClientRect();
|
|
75
75
|
const parentBox = target.offsetParent ? target.offsetParent.getBoundingClientRect() : targetBox;
|
|
76
76
|
|
|
77
|
-
// switch(action) {
|
|
78
|
-
// case 'resize':
|
|
79
|
-
// target.dataset.points = false;
|
|
80
|
-
// break;
|
|
81
|
-
// }
|
|
82
|
-
|
|
83
77
|
// Insert the new 2D canvas element or find the existing one
|
|
84
78
|
if (target.dataset.backgroundCanvasId) {
|
|
85
79
|
document.getElementById(
|
|
@@ -87,24 +81,18 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
|
|
|
87
81
|
).remove();
|
|
88
82
|
}
|
|
89
83
|
const canvas = document.createElement('canvas');
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
canvas.style.height = `${targetBox.height + 4 * extension}px`;
|
|
103
|
-
canvas.width = targetBox.width + 4 * extension;
|
|
104
|
-
canvas.height = targetBox.height + 4 * extension;
|
|
105
|
-
canvas.style.pointerEvents = 'none';
|
|
106
|
-
target.parentNode.insertBefore(canvas, target);
|
|
107
|
-
// }
|
|
84
|
+
target.dataset.backgroundCanvasId = generateRandomHex(12);
|
|
85
|
+
canvas.id = target.dataset.backgroundCanvasId;
|
|
86
|
+
canvas.style.position = 'absolute';
|
|
87
|
+
canvas.style.zIndex = -1;
|
|
88
|
+
canvas.style.top = `${(targetBox.top - parentBox.top) - 2 * extension}px`;
|
|
89
|
+
canvas.style.left = `${(targetBox.left - parentBox.left) - 2 * extension}px`;
|
|
90
|
+
canvas.style.width = `${targetBox.width + 4 * extension}px`;
|
|
91
|
+
canvas.style.height = `${targetBox.height + 4 * extension}px`;
|
|
92
|
+
canvas.width = targetBox.width + 4 * extension;
|
|
93
|
+
canvas.height = targetBox.height + 4 * extension;
|
|
94
|
+
canvas.style.pointerEvents = 'none';
|
|
95
|
+
target.parentNode.insertBefore(canvas, target);
|
|
108
96
|
|
|
109
97
|
// Add rotation
|
|
110
98
|
if (!target.dataset.jauntRotation) {
|
|
@@ -163,10 +151,10 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
|
|
|
163
151
|
// modify the direction of jiggle based on modifications
|
|
164
152
|
switch (mod) {
|
|
165
153
|
case JIGGLE_LEFT:
|
|
166
|
-
xRandom *= -
|
|
154
|
+
xRandom *= -1;
|
|
167
155
|
break;
|
|
168
156
|
case JIGGLE_RIGHT:
|
|
169
|
-
xRandom *=
|
|
157
|
+
xRandom *= 1;
|
|
170
158
|
break;
|
|
171
159
|
default:
|
|
172
160
|
// modify the corners less
|
|
@@ -175,10 +163,10 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
|
|
|
175
163
|
}
|
|
176
164
|
switch (mod) {
|
|
177
165
|
case JIGGLE_UP:
|
|
178
|
-
yRandom *= -
|
|
166
|
+
yRandom *= -1;
|
|
179
167
|
break;
|
|
180
168
|
case JIGGLE_DOWN:
|
|
181
|
-
yRandom *=
|
|
169
|
+
yRandom *= 1;
|
|
182
170
|
break;
|
|
183
171
|
default:
|
|
184
172
|
// modify the corners less
|
|
@@ -203,8 +191,8 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
|
|
|
203
191
|
boxes.forEach((lineBox, i) => {
|
|
204
192
|
const points = [];
|
|
205
193
|
// dimension constants to use for points
|
|
206
|
-
const lineWidth = lineBox.width + (target.dataset.jauntFull ? -
|
|
207
|
-
const lineHeight = lineBox.height + (target.dataset.jauntFull ? -
|
|
194
|
+
const lineWidth = lineBox.width + (target.dataset.jauntFull ? -extension : (4 * extension));
|
|
195
|
+
const lineHeight = lineBox.height + (target.dataset.jauntFull ? -extension : (4 * extension));
|
|
208
196
|
const left = lineBox.left - targetBox.left + (target.dataset.jauntFull ? (3 * extension) : 0);
|
|
209
197
|
const right = lineBox.left - targetBox.left + (target.dataset.jauntFull ? (3 * extension) : 0) + lineWidth;
|
|
210
198
|
const top = lineBox.top - targetBox.top + (target.dataset.jauntFull ? (2 * extension) : 0);
|
|
@@ -322,12 +310,12 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
|
|
|
322
310
|
};
|
|
323
311
|
|
|
324
312
|
// The main event
|
|
325
|
-
const createBackground = (action = null) => {
|
|
313
|
+
const createBackground = (action = null, context = document) => {
|
|
326
314
|
oneRemInPx = parseFloat(
|
|
327
315
|
getComputedStyle(document.documentElement).fontSize
|
|
328
316
|
);
|
|
329
317
|
|
|
330
|
-
const targets =
|
|
318
|
+
const targets = context.querySelectorAll('[data-jaunt-factor]');
|
|
331
319
|
|
|
332
320
|
// Insert some jaunt
|
|
333
321
|
targets.forEach((target) => {
|
|
@@ -337,19 +325,19 @@ https://www.bennadel.com/blog/4310-detecting-rendered-line-breaks-in-a-text-node
|
|
|
337
325
|
|
|
338
326
|
const processEvent = (e) => {
|
|
339
327
|
jauntTarget(e.target, e.type);
|
|
340
|
-
}
|
|
328
|
+
};
|
|
341
329
|
|
|
342
330
|
const observer = new IntersectionObserver((entries) => {
|
|
343
|
-
entries.forEach(entry => {
|
|
331
|
+
entries.forEach((entry) => {
|
|
344
332
|
jauntTarget(entry.target, 'visibility');
|
|
345
333
|
});
|
|
346
334
|
}, {
|
|
347
|
-
root: document.documentElement
|
|
335
|
+
root: document.documentElement,
|
|
348
336
|
});
|
|
349
337
|
|
|
350
|
-
const init = () => {
|
|
351
|
-
const targets =
|
|
352
|
-
createBackground('init');
|
|
338
|
+
const init = (context = document) => {
|
|
339
|
+
const targets = context.querySelectorAll('[data-jaunt-factor]');
|
|
340
|
+
createBackground('init', context);
|
|
353
341
|
targets.forEach((target) => {
|
|
354
342
|
[
|
|
355
343
|
'blur',
|