I need to know the position of the "active owl element", I know that the current position is 2. There are 3 photos in total.
<div style="transform: translate3d(-825px, 0px, 0px); transition: all 0.25s ease 0s; width: 48675px;" class="owl-stage">
<div style="width: 825px; margin-right: 0px;" class="owl-item">
<div class="gallery-item" style="background-image: url('/image/144/1.jpg');"></div>
</div>
<div style="width: 825px; margin-right: 0px;" class="owl-item active">
<div class="gallery-item" style="background-image: url('/image/144/2.jpg');"></div>
</div>
<div style="width: 825px; margin-right: 0px;" class="owl-item">
<div class="gallery-item" style="background-image: url('/image/144/3.jpg');"></div>
</div>
</div>
How can I get the position of this "active owl element" using jQuery.each ()?
I have this code, but I can’t find a way for the code to tell me that this “active owl element” is in position 2.
$('.owl-stage .owl-item').each(function( index, currentElement ) {
console.log( index+1 );
});
Can someone let me know how to do this?
André source
share