Set active class at the beginning of the slide animation
See original GitHub issueI’m trying to understand why the active class on slides (glide__slide--active
) is only set after the transition ended and not already when it starts - or why there are no intermediate classes for the status of sliding.
Is there a way to configure this behavior right now?
I’m asking because this would make parallel css transitions while it’s sliding possible (for example scaling the active slide a little bit), but with the current approach it’s only executed after the slide animation is finished.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:6
Top Results From Across the Web
Slick Carousel target active slide to add and remove ...
slick-active class is dynamically generated by the slick carousel . I am targeting the p element in the above HTML code. The animated...
Read more >Set active class at the beginning of the slide animation
I'm trying to understand why the active class on slides ( glide__slide--active ) is only set after the transition ended and not already...
Read more >How To Add Active Class To Current Element - W3Schools
Learn how to add an active class to the current element with JavaScript. Highlight the active/current (pressed) button: 1 2 3 4 5....
Read more >Using CSS animations - CSS: Cascading Style Sheets | MDN
Animations consist of two components, a style describing the CSS animation and a set of keyframes that indicate the start and end states...
Read more >Carousel · Bootstrap v5.1
The .active class needs to be added to one of the slides otherwise the carousel will not be visible. Also be sure to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got this to work with a custom component. Inside a component you can access other core components such as the Html Component, which lets you access the current slide element and add classes to it. I added my own is-active, is-next and is-prev classes to the respective elements and then added custom transitions via CSS.
And then register the component when mounting:
It partially works on the carousel type (Infinite scrolling). It breaks when transitioning from the last slide to the first one. I fixed it using by grabbing the inactive slide that is at the right of the last active slide, and the same for the first active slide by grabbing the previous inactive slide.