Fancybox urls without .jpg opens not in box
Asked Answered
P

1

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 !

Pozzuoli answered 31/8, 2013 at 11:38 Comment(4)
what does the php render to? what is an example $fic_serieOttavia
Check your jQuery you have syntax errors, opening and closing parens and braces don't matchRadnorshire
It generates links lile this <div id="contenu_artist"><a class="fancybox" href="square/booth-camp-1m_1_x-1.jpg" rel="group1"><img alt="" src="square/booth-camp-1m_1_x-1.jpg"></img></a><a class="fancybox" href="square/booth-camp-2_x.jpg" rel="group1"> … </a><a class="fancybox" href="square/booth-camp-3_x.jpg" rel="group1"> … </a>. I tried re-writing the jquery like you suggested cjross, but still not working ( adress of the page : ondinevermenot.fr/ok/artist.php?ID=79 )Pozzuoli
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 !Pozzuoli
T
24

try this code

<script type="text/javascript">
$(document).ready(function() {
  $(".fancybox").fancybox({
    type        : 'image',
    openEffect  : 'none',
    closeEffect : 'none'
  });
});
</script>
Trahurn answered 1/9, 2013 at 0:55 Comment(1)
Why and more alternatives to this code can be found here https://mcmap.net/q/1016764/-fancybox-links-don-39-t-show-in-lightbox-what-am-i-missingTrahurn

© 2022 - 2024 — McMap. All rights reserved.