Skip to content

Commit 5ce51e6

Browse files
committed
enhance mobile-triggered animations for footer links; update crumple.css and footer-delay.js to support JavaScript-based animation triggers
1 parent c9b5afd commit 5ce51e6

File tree

2 files changed

+60
-6
lines changed

2 files changed

+60
-6
lines changed

css/crumple.css

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -640,16 +640,66 @@ body:has(.footer__link--home:hover) .crumple:after {
640640
}
641641
}
642642

643-
/* Mobile Scroll Test - Trigger animations on scroll */
643+
/* Mobile JavaScript Trigger Support */
644644
@media (hover: none) and (pointer: coarse) {
645-
/* Test if animations work by triggering on scroll */
646-
body:has(.footer__link--writings) .crumple {
645+
/* Trigger animations via JavaScript-added classes */
646+
body:has(.footer__link--home.mobile-trigger) .crumple {
647647
background: #020121;
648648
z-index: 0;
649649
}
650650

651-
body:has(.footer__link--writings) .crumple:after {
651+
body:has(.footer__link--home.mobile-trigger) .crumple:after {
652+
-webkit-animation: a 1s .25s linear forwards;
653+
animation: a 1s .25s linear forwards;
654+
}
655+
656+
body:has(.footer__link--writings.mobile-trigger) .crumple {
657+
background: #020121;
658+
z-index: 0;
659+
}
660+
661+
body:has(.footer__link--writings.mobile-trigger) .crumple:after {
652662
-webkit-animation: e 1s .25s linear forwards;
653663
animation: e 1s .25s linear forwards;
654664
}
665+
666+
body:has(.footer__link--github.mobile-trigger) .crumple {
667+
background: #012118;
668+
z-index: 0;
669+
}
670+
671+
body:has(.footer__link--github.mobile-trigger) .crumple:after {
672+
-webkit-animation: b 1s .25s linear forwards;
673+
animation: b 1s .25s linear forwards;
674+
}
675+
676+
body:has(.footer__link--playlists.mobile-trigger) .crumple {
677+
background: #210120;
678+
z-index: 0;
679+
}
680+
681+
body:has(.footer__link--playlists.mobile-trigger) .crumple:after {
682+
-webkit-animation: c 1s .25s linear forwards;
683+
animation: c 1s .25s linear forwards;
684+
}
685+
686+
body:has(.footer__link--instagram.mobile-trigger) .crumple {
687+
background: #210120;
688+
z-index: 0;
689+
}
690+
691+
body:has(.footer__link--instagram.mobile-trigger) .crumple:after {
692+
-webkit-animation: f 1s .25s linear forwards;
693+
animation: f 1s .25s linear forwards;
694+
}
695+
696+
body:has(.footer__link--alhambra.mobile-trigger) .crumple {
697+
background: #020121;
698+
z-index: 0;
699+
}
700+
701+
body:has(.footer__link--alhambra.mobile-trigger) .crumple:after {
702+
-webkit-animation: d 1s .25s linear forwards;
703+
animation: d 1s .25s linear forwards;
704+
}
655705
}

js/footer-delay.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,10 @@ function initFooterDelay() {
197197
}
198198

199199
if (animationName) {
200-
// Create a temporary style to trigger the animation
200+
// Add mobile-trigger class for CSS-based animation
201+
this.classList.add('mobile-trigger');
202+
203+
// Also create a temporary style as fallback
201204
const style = document.createElement('style');
202205
let backgroundStyle = '';
203206

@@ -220,11 +223,12 @@ function initFooterDelay() {
220223
`;
221224
document.head.appendChild(style);
222225

223-
// Remove the style after animation completes
226+
// Remove the style and mobile-trigger class after animation completes
224227
setTimeout(() => {
225228
if (style.parentNode) {
226229
style.parentNode.removeChild(style);
227230
}
231+
this.classList.remove('mobile-trigger');
228232
}, 1500);
229233

230234
// Show animation indicator

0 commit comments

Comments
 (0)