-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a class only to the snapped slide #542
Comments
Adding a class only to the snapped slide
To be released with v8.0.0-rc12. |
@jln13x this feature has been released with v8.0.0-rc12. |
Hi @davidjerleke. Can you elaborate on how to use classnames (if possible) with tailwind css? |
@HarshArora-1205 I don’t understand the question? Please share some details about what you want to achieve. |
Okay, so, in runtime the plugin adds class When I am using Tailwind css, I wanted to tweak certain properties like opacity and other props by tracking So, I stumbled upon this thread in tailwind discussions: Thus I got to a workaround: This worked well and my query got resolved. |
@HarshArora-1205 if I'm understanding you correctly, you can configure the snapped class with the snapped option: ClassNames({ snapped: 'my-tailwind-class-goes-here' }) Is this what you're looking for? |
Uhm no. default class is okay for me, but when an active slide gets the class is snapped then I want that slide to have full opacity. This can be done by using custom classes and rules. But like we have hover:opactity-100 class in tailwind to set opacity on hover, is there any way to access if is snapped class is set on the slide or not. Something like [.is-snapped]:opacity-100. Anyways, as I cleared earlier this was more related to tailwind than embla. |
Feature request is for:
Discussed in #374
Originally posted by jln13x September 15, 2022
Hey there,
first of all: Embla is amazing, thanks for your work!
I constantly ran into the requirement to only style the currently snapped slide (usually the one in the center) and the plugin
embla-carousel-class-names
couldn't help with that. The closest option would be theselected
one however that applies to all visible slides which is not something that I want.Use Case:
So I went ahead and quickly wrote a plugin for it and published it to npm to reuse it across multiple projects. The plugin basically just adds a class and allows me to style it.
Would that be something for the
embla-carousel-class-names
-Plugin ?If so, I would go ahead and contribute to it and delete my stuff.
If not, is it ok for me to keep the plugin published? Anything I should add?
Thanks alot!
Specification
@jln13x
The text was updated successfully, but these errors were encountered: