我添加了bootstrap轮播,其中div item 在下面显示的for循环中创建 . 我在每个 item div中都有 9 小图像,它会动态填充 . 现在在旋转木马游戏中我看到div item 随着活动类的变化而变化但是我看到的第一个div item 内容也是可见的,当第二个 item div处于活动状态时类似于第三个项目div激活时,第一个和第二个div项也可见 . 此外 data-pause="hover" 无效 .
<div class="col-md-4 col-md-offset-4">
<div id="custCarousel" class="carousel slide" data-ride="carousel" data-pause="hover">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#custCarousel" data-slide-to="0" class="active"></li>
<li data-target="#custCarousel" data-slide-to="1"></li>
<li data-target="#custCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<?php
$counttoken = 9;
$loop = round($arrloop/9);
$k=0;
for($j=0;$j<$loop;$j++)
{
if($k==0){$act='active';}else{$act ='';}
echo '<div class="item '.$act.'">';
for($i=0; $i<$counttoken;$i++)
{
$img = $data[$rand_keys[$i]];
echo "<a href=".$img[1]."><img src=".$img[2]." alt=".$img[0]." width='100' /></a>";
}
$counttoken = $counttoken + 9;
$k++;
echo '</div>';
}
?>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#custCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#custCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
1 回答
对不起,这是我的错我在我的PHP代码中更新for循环 . 下面是更新的代码,它现在正在运行 .