我有一个带有 3 个可见项目的 rcarousel,当我单击一个项目时,会从所有项目中删除一个类并添加到被单击的项目中。但是,DOM 中唯一的项目是可见的 3 个。因此,如果具有该类的项不可见,并且用户单击另一项,并且您滚动回上一项,则选择了两项。如何访问不可见的项目以从这些项目中删除课程?
这是HTML:
<div id="seitemvideocarouselcontainer">
<div id="ui-carousel-prev"></div>
<div class="seitemvideocarousel">
<div class="carousel-item">
<div class="videothumbnail">
<img class="seitemvideocarousel-90 selected" src="/images/library/videothumb/363303782_200.jpg" onclick="selectVideo(90)" title="Econom Recharge" alt="Econom Recharge">
</div>
<div class="videotitle">
Econom Recharge
</div>
</div>
<div class="carousel-item">
<div class="videothumbnail">
<img class="seitemvideocarousel-84 " src="/images/library/videothumb/363159759_200.jpg" onclick="selectVideo(84)" title="Nalini Antares 12" alt="Nalini Antares 12">
</div>
<div class="videotitle">
Nalini Antares 12
</div>
</div>
<div class="carousel-item">
<div class="videothumbnail">
<img class="seitemvideocarousel-2420 " src="/images/library/videothumb/5g8RYa1Aams.jpg" onclick="selectVideo(2420)" title="Mucka Blucka b" alt="Mucka Blucka b">
</div>
<div class="videotitle">
Mucka Blucka b
</div>
</div>
<div class="carousel-item">
<div class="videothumbnail">
<img class="seitemvideocarousel-2438 " src="/images/library/videothumb/TTqpEJh03fI.jpg" onclick="selectVideo(2438)" title="I Uploaded This Video!" alt="I Uploaded This Video!">
</div>
<div class="videotitle">
I Uploaded This Video!
</div>
</div>
</div>
<div id="ui-carousel-next"></div>
这是 rcarousel 调用:
$('.seitemvideocarousel').rcarousel({
orientation: 'vertical'
, visible: 3
, width: 150
, height: 120
, start: onCarouselPageLoaded
, pageLoaded: onCarouselPageLoaded
});