我有一个包含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
});
答案 0 :(得分:0)
$('.event').on('click', function(e) {
// Change this to selector or leave to remove class
$(this).removeClass("class-to-remove');
});
不完全确定您要查找的内容,但这是一个基本点击事件+删除类功能。