Materialize: How to get the focus carousel-item in javascript

Created on 11 Jan 2017  路  3Comments  路  Source: Dogfalo/materialize

Description

Add a detailed description of your issue.

Carousel items don't have active class or id to recognize them, so is there any way to get/select them whith javascript?

Most helpful comment

@MickaelH974 You can try and use this until there is something easier to use (if such a function is implemented ever):

$('.carousel').find('.carousel-item[style*="z-index: 0"]')

That will return the top most carousel-item (the active one).

All 3 comments

@MickaelH974 You can try and use this until there is something easier to use (if such a function is implemented ever):

$('.carousel').find('.carousel-item[style*="z-index: 0"]')

That will return the top most carousel-item (the active one).

Added active class to center carousel item in 7e51730

Thanks, I've used Z-index and Opacity to get the top carousel-item.

Happy to see that we have now an Active class, very good job ;-) and thanks to your answer

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hartwork picture hartwork  路  3Comments

ericlormul picture ericlormul  路  3Comments

acierpinski picture acierpinski  路  3Comments

samybob1 picture samybob1  路  3Comments

onigetoc picture onigetoc  路  3Comments