我有大约10-15张幻灯片。
最大幻灯片是4,但只显示1张幻灯片。当页面加载时,滑块"闪烁",并显示4张幻灯片,但之后,再次显示一张幻灯片。
滑块有什么问题?感谢帮助!
您可以在此处查看问题:Click
<div class="home-slider-wrapper">
<?php
$get_slides = mysqli_query($kapcs, "SELECT * FROM slideshow WHERE slide_status = 1 ORDER BY slide_sorrend ASC");
if(mysqli_num_rows($get_slides) > 0 )
{
echo '<ul class="bxslider">';
while($slide = mysqli_fetch_assoc($get_slides))
{
if($slide['slide_link'] == "" )
{
echo '<li><img src="'.$host.'/images/homepage_slideshow/'.html($slide['slide_img']).'" title="'.html($slide['slide_cim']).'" /></li>';
}
else
{
echo '<li><a href="'.html($slide['slide_link']).'" title="'.html($slide['slide_cim']).'" target="'.html($slide['slide_link_target']).'"><img src="'.$host.'/images/homepage_slideshow/'.html($slide['slide_img']).'" title="'.html($slide['slide_cim']).'" /></a></li>';
}
}
echo '</ul>';
}
?>
</div>
$('.kiemelt_termekek_slider').bxSlider({
auto: true,
mode: 'horizontal',
captions: false,
minSlides: 4
//maxSlides: 4
});
答案 0 :(得分:1)
这里的问题是您缺少'slideWidth'。试试这个:
$('.kiemelt_termekek_slider').bxSlider({
minSlides: 4,
maxSlides: 4,
auto: true,
mode: 'horizontal', // This is default so you don't need it
captions: false,
slideWidth: 365, // This is your missing link. Change this to the width of the slide you want and bxslider will do the appropriate calculation
});
注意:我已在代码中将以下文档中的“模式”默认设置为“水平”:
编辑:上面的代码将其显示为选择器:
echo '<ul class="bxslider">';
如果这是您真正针对的目标,则需要将其更改为“ kiemelt_termekek_slider”。要么将您的jQuery更改为以下内容:
$('.bxslider').bxSlider({
minSlides: 4,
maxSlides: 4,
auto: true,
mode: 'horizontal', // This is default so you don't need it
captions: false,
slideWidth: 365, // This is your missing link. Change this to the width of the slide you want and bxslider will do the appropriate calculation
});
答案 1 :(得分:0)
基于他们在此处看到的示例 - http://bxslider.com/examples/carousel-static-number-slides
$('.kiemelt_termekek_slider').bxSlider({
minSlides: 4,
maxSlides: 4,
auto: true,
mode: 'horizontal',
captions: false
});
闪烁可能与您在图像中的加载方式有关。