79
Views
4
Comments
Dynamic css on Carousel
Application Type
Mobile

Hi all,

My req is that I have a carousel and inside Carousel There are many Card and I want to change css of card Dynamic:

Example :

when I set Carousel Position =4 than i want to change 4th card background color:

is it Possible . please suggest any idea how to implement it


Thanks

2021-06-02 20-50-04
Márcio Carvalho

Using the index of the active element, if it returns the last id, you just need to increment (I am saying this because I didn't test)

When is 4 you can use a class to apply to the card style classes the styles you want. In the last case, you can use inline styles, but I don't recommend just in case you cannot control the number of background colors to give to the cards.


Let us know if worked

Regards,

Márcio

2023-10-21 19-42-11
Tousif Khan
Champion

Hello

Based on the postion stored in your variable, you can change the condition and apply different Css classes

for example 

You need to go to the Class property  and in that you can define a condition as required.

You can also do that with Javascript You jave to pass a variable which will hold the value of the position

and using If else, or switch , you can apply Css

Check here


Hope this helps 

Thanks

UserImage.jpg
Md Mansur

I have a carousel and inside carousel   have a list and inside list  have card. I got the position but I want to ask one things This css applied for carousel  or list or card ???

2021-06-02 20-50-04
Márcio Carvalho

Card. You want to give style to the card, not List or Carousel. Try to do some paddings in case the image is the same size as the card.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.