轮播我一次只显示一个帖子。理想情况下,我想使用PHP来显示mysql查询。 JS
和HTMl
代码有什么问题?
当我看到小提琴演示时,它很有效,直到我把它放在我的网站上。乍一看有什么不对劲。
幻灯片的元素只会显示为一张幻灯片一直显示在左侧。
<div class="carousel-inner">
<?php
$count_row = 0;
while ($row2 = mysqli_fetch_array($result)){
if ($count_row == 0 ){
?>
<div class="item active">
<div class="col-xs-4">
<a href="#1"><img src="post_image/Snip20161219_9.png" class="img-responsive"></a>
</div>
</div>
<?php
$count_row = $count_row + 1;
} else if (count_row == 2) {
$count_row = $count_row + 1; ?>
<div class="item active">
<div class="col-xs-4">
<a href="#1"><img src="post_image/Snip20161219_9.png" class="img-responsive"></a>
</div>
</div>
<?php
$count_row = $count_row+1;
} else if (count_row == 1) { ?>
<div class="item active">
<div class="col-xs-4">
<a href="#1"><img src="post_image/Snip20161219_9.png" class="img-responsive"></a>
</div>
</div>
<?php
$count_row = $count_row+1;
} else { ?>
<div class="item">
<div class="col-xs-4">
<a href="#1"><img src="post_image/Snip20161219_9.png" class="img-responsive"></a>
</div>
</div>
<?php
$count_row = $count_row + 1;
}
?>
<?php };?>
</div>
JAVASCRIPT
$(document).ready(function() {
// Instantiate the Bootstrap carousel
$('.multi-item-carousel').carousel({
interval: false
});
// for every slide in carousel, copy the next slide's item in the slide.
// Do the same for the next, next item.
$('.carousel .item').each(function() {
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
if (next.next().length > 0) {
next.next().children(':first-child').clone().appendTo($(this));
} else {
$(this).siblings(':first').children(':first-child').clone().appendTo($(this));
}