Fancybox urls without .jpg opens not in box

2020-03-23 18:02发布

I have seen a similar question here : Fancybox chokes on a URL that contains "&" And I have tried all offered solutions but none of them work ! I have included correctly all links, ( the jquery link first ) I checked, and at the beginning of my document, I declared fancybox like this :

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

My code is :

   echo '<a class="fancybox" rel="group1" href="square/'.$fic_serie .'">
<img src="square/'.$fic_serie .'" alt=""/></a>';

$fic_serie is the var that will get replaced by the image name

Right now, I feel like nothing works; the images are way too big compared to how I said they should be ( in the fancybox.js file ) and when I click on them, they open as a link, not in lightbox.

I have also tried

class='fancybox fancybox.image'

but without luck.... Thank you !

1条回答
贪生不怕死
2楼-- · 2020-03-23 18:48

try this code

<script type="text/javascript">
$(document).ready(function() {
  $(".fancybox").fancybox({
    type        : 'image',
    openEffect  : 'none',
    closeEffect : 'none'
  });
});
</script>
查看更多
登录 后发表回答