如何使用Owl Carousel v2获取当前元素的ID?
$('.owl-carousel').on('dragged.owl.carousel', function(e) {
// get id; only one slide visible in this case
});
<div class="owl-carousel owl-theme">
<div class="item" id='1'><h4>1</h4></div>
<div class="item" id='2'><h4>2</h4></div>
<div class="item" id='3'><h4>3</h4></div>
<div class="item" id='4'><h4>4</h4></div>
<div class="item"><h4>5</h4></div>
<div class="item"><h4>6</h4></div>
<div class="item"><h4>7</h4></div>
<div class="item"><h4>8</h4></div>
<div class="item"><h4>9</h4></div>
<div class="item"><h4>10</h4></div>
<div class="item"><h4>11</h4></div>
<div class="item"><h4>12</h4></div>
</div>
回调将返回&#34; 1&#34;如果第一张幻灯片可见。