Carousel crossfade > Prevent the background to be shown when transitioning#27529
Conversation
midzer
left a comment
There was a problem hiding this comment.
I can clearly experience an improved crossfade on your demo. Awesome, will definetly use it in some of my projects soonish. JS code looks flawlessly on first glance and CSS appears tidy, too.
|
Thanks @midzer! |
Johann-S
left a comment
There was a problem hiding this comment.
Works fine to me 👍
Can you add a unit test, which show we handle transition-delay too please ?
There was a problem hiding this comment.
So this is only added so that we get the value in JS?
There was a problem hiding this comment.
And to prevent the transition of the carousel item that is "fading out". We need this because otherwise the classes are removed immediately.
There was a problem hiding this comment.
Just wondering if we could use the transition shorthand, that's why I'm asking.
There was a problem hiding this comment.
I can use the shorthand to combine these lines indeed:
https://github.com/twbs/bootstrap/blob/9b3c66258997c10f8bdb1ea521ed64e3775da39d/scss/_carousel.scss#L100-L101
I'll look into that
But I'll still need the $carousel-transition-duration option as a separate variable.
29aca1f to
168c422
Compare
|
@MartijnCuppens so this seems to break on IE 10. See for example https://travis-ci.org/twbs/bootstrap/jobs/448234618#L633 |
When the carousel is transitioning, the background is shown through the images. This PR prevents this from happening by disabling the transition of the carousel item that is fading out and raising the
z-indexof the carousel item that is fading in. I also needed to raise thez-indexof the carousel controls, the indicators had az-indexwhich was high enough.I had to add the
transition-delayto thegetTransitionDurationFromElementfunction to prevent the classes to be removed too soon. Not sure if we should rename this function to make this clear or not.Issue:
https://getbootstrap.com/docs/4.1/components/carousel/#crossfade
Demo new carousel:
https://deploy-preview-27529--twbs-bootstrap4.netlify.com/docs/4.1/components/carousel/#crossfade