我试图从mysql表中获取所有图像并将它们显示在bootstrap轮播中,但所有图像同时显示,即静态,它们不会滑动。我错了什么?
这是代码:
echo "<div id='myCarousel' class='carousel slide' data-ride='carousel'>
<!-- Wrapper for slides -->
<div class='carousel-inner' role='listbox'>
<div class='item active'>
";
foreach ($db->query($view_photo, array( 'offer_id' => $result['id_count'])) AS $result2){
echo "<img src='profile_pix/{$result2['photo']}' width = '150' height ='180px' style='padding:10px 0px 10px 10px;'/>
";}echo "
</div>
</div>
<a class='left carousel-control' href='#myCarousel' role='button' data-slide='prev'>
<span class='glyphicon glyphicon-chevron-left' aria-hidden='true'></span>
<span class='sr-only'>Previous</span>
</a>
<a class='right carousel-control' href='#myCarousel' role='button' data-slide='next'>
<span class='glyphicon glyphicon-chevron-right' aria-hidden='true'></span>
<span class='sr-only'>Next</span>
</a>
</div>
";
答案 0 :(得分:0)
似乎您正在将所有图像添加到课程项目 - 活动中。如果它是幻灯片放映中当前活动项目的类,请尝试使用jquery将该类添加到图像中。