gpt4 book ai didi

javascript - Cycle2 未运行

转载 作者:行者123 更新时间:2023-12-03 11:16:19 34 4
gpt4 key购买 nike

我需要使用 Cycle2 对特定文件夹中的图像运行幻灯片放映。下面是我的标记和 php:

<div class="cycleShow">
<?php
$dir = 'img/';
$files = scandir($dir);
foreach($files as $file) {
if($file !== '.' && $file !== '..'){
$tag = '<img class="thumbNail" src="' . $dir . $file . '" />';
echo $tag;
}
}
?>
</div>

<button onClick="slideshow();">Start</button>

以及功能......

    function slideshow() {
$('.cycleShow').cycle();
}

执行时,图像加载到 div 中。但点击按钮时没有幻灯片。

最佳答案

您的 div 类不正确,应该是 class='cycle-slideshow'

关于javascript - Cycle2 未运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27330815/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com