我正在尝试建立一个书籍轮播,根据我们目录中的项目显示可在图书馆结账的书籍。我正在查询MySQL数据库以获取与特定查询匹配的项目,并将其与Malsup Cycle2 php库一起使用。我的图像将显示在屏幕上,但我只看到一个图像,它消失了,另一个放大。我希望能够一次看到5本书的封面,并且有一个卷轴和另一个卷轴。这是我的代码。
$con = mysqli_connect("1.2.3.4","user","pass","database");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_set_charset($con, "utf8");
$sql = "SELECT DISTINCT bibs.record_id, "
. "bibs.TITLE, bibs.AUTHOR, bibs.ISBNISSN, bibs.RECORDKEY, items.itemstatus, "
. "items.bib_record_id, items.locationcode, items.branchcode "
. "FROM bibs "
. "INNER JOIN items ON bibs.record_id = items.bib_record_id "
. "WHERE bibs.CATDATE >= '$last_thirty_days' "
. "AND bibs.MATTYPE = 'a' "
. "AND bibs.ISBNISSN != '' "
. "AND items.locationcode LIKE '%af%' "
. "AND items.branchcode = '1' "
. "AND items.locationcode NOT LIKE '%wb%' "
. "GROUP BY bibs.record_id "
. "LIMIT 15";
$result = mysqli_query($con,$sql);
?>
<ul class="cycle-slideshow"
data-cycle-carousel-visible="5"
data-cycle-fx="scrollHorz"
data-cycle-slides="li">
<?php
while ($bibs = mysqli_fetch_assoc($result)) {
$bookcoverURL = createImageURL($bibs['ISBNISSN']);
?>
<li> <a href = "<?php echo $encoreURL; ?>">
<img width=188px height=300px src="<?php echo $bookcoverURL;?>">
</a></li>
<?php }
mysqli_free_result($result);
mysqli_close($con);
?>
</ul>
</div>
<br />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="includes/jquery.cycle2.js"></script>
</body>
答案 0 :(得分:0)
我已经回答了我自己的问题。它没有在演示页面上指定,但为了使轮播工作并使图像正确转换,您需要包含此页面上提供的一个可选插件http://jquery.malsup.com/cycle2/download/
在我下载并包含该插件后,轮播正在按预期工作。