简体   繁体   English

从数据库(PHP)获取图像时,Fancybox无法正常工作

[英]Fancybox didn't work while getting images from database (php)

<?php
 $sqlInner=" select * from gallery_photos where series_id='".$row['id']."' ";
 $rr = mysql_query($sqlInner,$con); 
 while($data=mysql_fetch_array($rr))    {
    echo"<a class='fancybox' rel='gallery' href='images/gallery_photos/".$data['photo_path']."'><img src='images/gallery_photos/".$data['photo_path']."'width='150' height='150' ></a>";
 }
?>


 <script type="text/javascript">
  $(document).ready(function() {
    $(".fancybox").fancybox({'type' : 'image'})
});
</script>

it didn't work for me, I'm just a beginner. 它对我不起作用,我只是一个初学者。 Help needed. 需要帮助。

Thanks in advance. 提前致谢。

is it working fine with static images? 静态图片可以正常工作吗? If yes then try below code 如果是,请尝试以下代码

<script type="text/javascript">
    $(document).ready(function() {
     $(".fancybox").fancybox({type : 'image'})
    });
</script>

try to remove "type:image": 尝试删除“类型:图像”:

<script type="text/javascript">
$(document).ready(function() {
    $(".fancybox").fancybox();
});

Try adding data-fancybox-type="image" property to anchor tags. 尝试将data-fancybox-type =“ image”属性添加到定位标记。 It worked for me. 它为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM