I have this code:

function slideshow(){
    $allfilesslides = glob(SITE_ROOT."/img/slideshow_slide*.png");
    $file_num_slide = count($allfilesslides)+1;
    if($file_num_slide > 0){
        echo '<div class="slider"><ul class="bxslider">';

        for($i = 1; $i < $file_num_slide; $i++){
            echo "<li><a href='img/slideshow_slide$i.png'><img src='img/slideshow_slide$i.png' /></a></li>";
        }
        echo "</ul></div>";
    } else{
        echo "";
    }
}

But it only displays one slide when I run the slideshow function.

有帮助吗?

解决方案

Have you checked the values of the bxSlider function ?

$j('.bxslider-2').show().bxSlider({
            slideWidth: 111,
            minSlides: 4,
            maxSlides: 7,
            moveSlides: 6,
            slideMargin: 10,
            speed: 1500,
            pager: false,
            infiniteLoop: false,
            hideControlOnEnd: true,
            onSliderLoad: function () {
                // do funky JS stuff here
            }
        });

especially minSlides, maxSlides and moveSlides. Are you assigning that value depending on the length of the elements you detect ?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top