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

<?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.

try to remove "type:image":

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

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 adding data-fancybox-type="image" property to anchor tags. It worked for me.