@hortonstudio/main 1.1.23 → 1.1.25
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/animations/hero.js +16 -6
- package/package.json +1 -1
- package/styles.css +0 -4
package/animations/hero.js
CHANGED
@@ -248,8 +248,11 @@ export async function init() {
|
|
248
248
|
headingSplits = [];
|
249
249
|
|
250
250
|
if (heading.length > 0) {
|
251
|
-
|
252
|
-
|
251
|
+
// Fresh DOM selection like text.js does
|
252
|
+
const freshHeadings = document.querySelectorAll('[data-hs-hero="heading"] > *:first-child');
|
253
|
+
|
254
|
+
freshHeadings.forEach((textElement, index) => {
|
255
|
+
const parent = textElement.parentElement;
|
253
256
|
const splitType = parent.getAttribute('data-hs-heroconfig') || 'word';
|
254
257
|
|
255
258
|
let splitConfig = {};
|
@@ -278,19 +281,24 @@ export async function init() {
|
|
278
281
|
elementsClass = 'words';
|
279
282
|
}
|
280
283
|
|
284
|
+
// Match text.js element state exactly - set autoAlpha before splitting
|
285
|
+
gsap.set(textElement, { autoAlpha: 1 });
|
286
|
+
|
281
287
|
const split = SplitText.create(textElement, splitConfig);
|
282
288
|
split.elementsClass = elementsClass;
|
283
289
|
headingSplits.push(split);
|
284
290
|
|
285
291
|
gsap.set(split[elementsClass], { yPercent: config.headingSplit.yPercent });
|
286
|
-
gsap.set(textElement, { autoAlpha: 1 });
|
287
292
|
});
|
288
293
|
}
|
289
294
|
|
290
295
|
// Split text setup for subheadings
|
291
296
|
if (subheading.length > 0) {
|
292
|
-
|
293
|
-
|
297
|
+
// Fresh DOM selection like text.js does
|
298
|
+
const freshSubheadings = document.querySelectorAll('[data-hs-hero="subheading"] > *:first-child');
|
299
|
+
|
300
|
+
freshSubheadings.forEach((textElement, index) => {
|
301
|
+
const parent = textElement.parentElement;
|
294
302
|
const splitType = parent.getAttribute('data-hs-heroconfig') || 'word';
|
295
303
|
|
296
304
|
let splitConfig = {};
|
@@ -319,12 +327,14 @@ export async function init() {
|
|
319
327
|
elementsClass = 'words';
|
320
328
|
}
|
321
329
|
|
330
|
+
// Match text.js element state exactly - set autoAlpha before splitting
|
331
|
+
gsap.set(textElement, { autoAlpha: 1 });
|
332
|
+
|
322
333
|
const split = SplitText.create(textElement, splitConfig);
|
323
334
|
split.elementsClass = elementsClass;
|
324
335
|
subheadingSplits.push(split);
|
325
336
|
|
326
337
|
gsap.set(split[elementsClass], { yPercent: config.subheadingSplit.yPercent });
|
327
|
-
gsap.set(textElement, { autoAlpha: 1 });
|
328
338
|
});
|
329
339
|
}
|
330
340
|
|
package/package.json
CHANGED