【发布时间】:2015-04-29 19:31:02
【问题描述】:
您好,我想检查一个 div 是否有活动的类。 第一项工作,之后它停止。有人可以告诉我如何解决这个问题吗? (它是一个滑块,所以它不能在点击时工作。)它会自动滑动。 http://i61.tinypic.com/28h2zb6.jpg
<script>
$(document).ready(function () {
if ($('#211').hasClass('item active')){
$('.vandaag').css("background-color", "blue");
console.log("werkt1!");}
else if ($('#218').hasClass('item active')){
$('.vandaag').css("background-color", "#005993");
console.log("werkt2!");}
else if ($('#219').hasClass('active')){
$('.vandaag').css("background-color", "#005993");
console.log("werkt3!");}
});
</script>
数字是图像滑块的 id。并且 .item .active 是幻灯片处于活动状态时。 问候
【问题讨论】:
标签: javascript jquery if-statement