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

cope picture cope  路  3Comments

acierpinski picture acierpinski  路  3Comments

djensen47 picture djensen47  路  3Comments

serkandurusoy picture serkandurusoy  路  3Comments

ReiiYuki picture ReiiYuki  路  3Comments