I am creating a simple gallery and fancybox does not seem to be firing and I have no idea why, I’ve used it before on other sites and works ok:
doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
script, css calls and js – script sources ok checked
<link href="../js/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="../js/fancybox/jquery.easing-1.3.pack.js" type="text/javascript"></script>
<script src="../js/fancybox/jquery.fancybox-1.3.4.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("a[rel=gallery]").fancybox({
'autoScale' : true,
'transitionIn' : 'fade',
'transitionOut' : 'fade'
}
});
});
</script>
and the php i’m using to generate the thumbs from folder and also the href to call fancybox
$files = glob("../gallery/gallery/*.*");
for ($i=1; $i<count($files); $i++)
{
$num = $files[$i]; echo '<a class="fancybox" rel=gallery href="'.$num.'">
<img src="'.$num.'" class="gallery_img" alt="random image"></a>';
}
this is the rendered html from the actual page:
<a class="fancybox" rel="gallery" href="../gallery/gallery/cat.jpg">
<img src="../gallery/gallery/cat.jpg" class="gallery_img" alt="random image">
</a>
<a class="fancybox" rel="gallery" href="../gallery/gallery/flypike.jpg">
<img src="../gallery/gallery/flypike.jpg" class="gallery_img" alt="random image">
</a>
<a class="fancybox" rel="gallery" href="../gallery/gallery/zandrb.jpg">
<img src="../gallery/gallery/zandrb.jpg" class="gallery_img" alt="random image"></a>
Complete syntax error found by console, many thanks for suggestion, never used that before: