Skip to content

Commit cb4c6ec

Browse files
authored
Merge pull request #1318 from makeabilitylab/1010-fix-banner-crossfade-blink
fix(carousel): eliminate banner "blink" on crossfade switch (#1010)
2 parents ff2f5df + 1aeb457 commit cb4c6ec

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

website/static/website/css/carousel_fade.css

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
* (.next/.prev/.left/.right); that machinery went away with the Bootstrap
1111
* carousel JS (Track A — issues #1288 / #1253), so the fade is now self-
1212
* contained CSS rather than a hack layered on Bootstrap's animation.
13+
*
14+
* Dip-free crossfade (issue #1010): the transition is asymmetric on purpose.
15+
* The INCOMING slide fades in (opacity 0 -> 1) while the OUTGOING slide holds
16+
* at full opacity, then snaps to 0 only after the incoming has fully covered
17+
* it. This guarantees an opaque slide always covers the carousel's magenta
18+
* gradient backdrop (#main-carousel in base.css). A naive *symmetric* crossfade
19+
* (both slides fading at once) lets up to ~25% of that backdrop bleed through
20+
* at the midpoint, which read as a "blink"/flash when switching banners.
1321
*/
1422

1523
.carousel-fade .carousel-inner > .item {
@@ -23,19 +31,24 @@
2331
z-index: 0;
2432
/* Only the visible slide should capture clicks. */
2533
pointer-events: none;
26-
transition: opacity 0.6s ease-in-out;
34+
/* Deactivating: hold opacity (0s change) until the incoming slide has faded
35+
fully in, i.e. delay the snap-to-0 by the fade duration. */
36+
transition: opacity 0s ease-in-out 0.6s;
2737
}
2838

2939
.carousel-fade .carousel-inner > .item.active {
3040
opacity: 1;
3141
z-index: 1;
3242
pointer-events: auto;
43+
/* Activating: fade in over the still-opaque outgoing slide. */
44+
transition: opacity 0.6s ease-in-out 0s;
3345
}
3446

3547
/* Respect users who prefer reduced motion: switch instantly, no crossfade.
3648
(carousel.js also disables autoplay under this preference.) */
3749
@media (prefers-reduced-motion: reduce) {
38-
.carousel-fade .carousel-inner > .item {
50+
.carousel-fade .carousel-inner > .item,
51+
.carousel-fade .carousel-inner > .item.active {
3952
transition: none;
4053
}
4154
}

0 commit comments

Comments
 (0)