5

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 !

Community
  • 1
  • 1
Dikeneko
  • 344
  • 4
  • 19
  • what does the php render to? what is an example `$fic_serie` – DGS Aug 31 '13 at 11:41
  • Check your jQuery you have syntax errors, opening and closing parens and braces don't match – cjross Aug 31 '13 at 11:56
  • It generates links lile this `
    `. I tried re-writing the jquery like you suggested cjross, but still not working ( adress of the page : http://ondinevermenot.fr/ok/artist.php?ID=79 )
    – Dikeneko Aug 31 '13 at 17:10
  • I just tried with a png image, to see if it was because of him not recognizing the image format but it doesn't work either ! – Dikeneko Aug 31 '13 at 17:21

1 Answers1

24

try this code

<script type="text/javascript">
$(document).ready(function() {
  $(".fancybox").fancybox({
    type        : 'image',
    openEffect  : 'none',
    closeEffect : 'none'
  });
});
</script>
JFK
  • 40,963
  • 31
  • 133
  • 306
  • 2
    Why and more alternatives to this code can be found here http://stackoverflow.com/a/17554660/1055987 – JFK Dec 11 '14 at 16:04