@widelab-nc/widehue 1.0.38 → 1.0.39
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/index.js +4 -4
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/index.js +68 -7
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -174,8 +174,51 @@ function revealFooter() {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
|
|
178
|
+
// Check if element exists in DOM
|
|
179
|
+
function checkElementExists(selector) {
|
|
180
|
+
const element = document.querySelector(selector);
|
|
181
|
+
if (!element) {
|
|
182
|
+
console.warn(`Element ${selector} not found - skipping animation`);
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Fallback function when loader elements don't exist
|
|
189
|
+
function initBasicAnimations() {
|
|
190
|
+
console.log('Initializing basic animations without loader');
|
|
191
|
+
|
|
192
|
+
if (typeof lenis !== 'undefined') {
|
|
193
|
+
try {
|
|
194
|
+
lenis.scrollTo(0, { immediate: true });
|
|
195
|
+
lenis.start();
|
|
196
|
+
} catch (e) {
|
|
197
|
+
console.warn('Lenis initialization failed:', e);
|
|
198
|
+
window.scrollTo(0, 0);
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
window.scrollTo(0, 0);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
177
205
|
function pageLoadAnimation() {
|
|
178
|
-
console.log('pageLoadAnimation function called');
|
|
206
|
+
console.log('pageLoadAnimation function called');
|
|
207
|
+
|
|
208
|
+
// Check if all required loader elements exist
|
|
209
|
+
const requiredElements = [
|
|
210
|
+
'.loader_ract.is-left',
|
|
211
|
+
'.loader_ract.is-right',
|
|
212
|
+
'.loader_wrapper'
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
const allElementsExist = requiredElements.every(selector => checkElementExists(selector));
|
|
216
|
+
|
|
217
|
+
if (!allElementsExist) {
|
|
218
|
+
console.warn('Loader elements not found - skipping loader animation');
|
|
219
|
+
initBasicAnimations();
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
179
222
|
|
|
180
223
|
const loaderAnimationIn = gsap.timeline({});
|
|
181
224
|
console.log('GSAP timeline created');
|
|
@@ -184,7 +227,18 @@ function pageLoadAnimation() {
|
|
|
184
227
|
.add(function() {
|
|
185
228
|
console.log('First animation step triggered: scrollRestoration and scrollTo');
|
|
186
229
|
history.scrollRestoration = 'manual';
|
|
187
|
-
|
|
230
|
+
|
|
231
|
+
// Safari-safe scroll to top
|
|
232
|
+
if (typeof lenis !== 'undefined' && lenis.scrollTo) {
|
|
233
|
+
try {
|
|
234
|
+
lenis.scrollTo(0, { immediate: true });
|
|
235
|
+
} catch (e) {
|
|
236
|
+
console.warn('Lenis scrollTo failed, using fallback:', e);
|
|
237
|
+
window.scrollTo(0, 0);
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
window.scrollTo(0, 0);
|
|
241
|
+
}
|
|
188
242
|
})
|
|
189
243
|
.to(
|
|
190
244
|
'.loader_ract.is-left',
|
|
@@ -207,7 +261,9 @@ function pageLoadAnimation() {
|
|
|
207
261
|
)
|
|
208
262
|
.add(function() {
|
|
209
263
|
console.log('lenis started');
|
|
210
|
-
lenis.start
|
|
264
|
+
if (typeof lenis !== 'undefined' && lenis.start) {
|
|
265
|
+
lenis.start();
|
|
266
|
+
}
|
|
211
267
|
}, '>')
|
|
212
268
|
.to('.loader_wrapper', {
|
|
213
269
|
display: 'none',
|
|
@@ -219,18 +275,23 @@ function pageLoadAnimation() {
|
|
|
219
275
|
|
|
220
276
|
console.log('Animation timeline defined');
|
|
221
277
|
|
|
222
|
-
// Update on screen resize
|
|
278
|
+
// Update on screen resize - with element existence check
|
|
223
279
|
window.addEventListener('resize', function () {
|
|
224
280
|
console.log('Window resize event triggered');
|
|
225
281
|
setTimeout(function () {
|
|
226
|
-
|
|
227
|
-
|
|
282
|
+
if (document.querySelector('.loader_wrapper')) {
|
|
283
|
+
console.log('Set .loader_wrapper to display:none on resize');
|
|
284
|
+
gsap.set('.loader_wrapper', { display: 'none' });
|
|
285
|
+
} else {
|
|
286
|
+
console.warn('Loader wrapper not found on resize');
|
|
287
|
+
}
|
|
228
288
|
}, 50);
|
|
229
289
|
});
|
|
230
290
|
|
|
231
291
|
console.log('Resize event listener added');
|
|
232
292
|
}
|
|
233
293
|
|
|
294
|
+
|
|
234
295
|
// Page transition animation
|
|
235
296
|
function pageTransitionAnimation() {
|
|
236
297
|
const transitionLinks = document.querySelectorAll(
|
|
@@ -516,7 +577,7 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
516
577
|
|
|
517
578
|
heroAnimation.to('.navbar_brand_lottie', {
|
|
518
579
|
duration: 1.5,
|
|
519
|
-
progress: 1
|
|
580
|
+
// Usuń progress: 1 całkowicie
|
|
520
581
|
onComplete: function() {
|
|
521
582
|
console.log('Lottie animation completed');
|
|
522
583
|
gsap.to('.navbar_brand_lottie', { opacity: 0, duration: 0.25 });
|