I’m using fancybox (2.15) and elevatezoom (3.0.8) that come with Magento 1.9.2.4, to zoom the main image and create a fancybox gallery with the other images of the gallery. Fancybox is opened when clicking on the main image.
What i need, is to use the thumbnail helper to navigate the thumbnails while the fancybox is open, but the problem is that I’m not able to initialize it in the easiest and suggested way, like
$(selector).fancybox({config});
and the way i’m using has no effect on the fancybox appearance.
This is the code i’m using
js
$(document).ready(function() {
if($('.thumb-link').size() == 0){
var ez = $('.gallery-image.visible').first().data('zoom-image');
}else{
var ez = $(".thumb-link");
}
$.fancybox({
'width':400,
'height': 500,
helpers : {
title : {
type: 'outside'
},
thumbs : {
width : 50,
height : 50
}
}
});
$(".gallery-image.visible").bind("click", function(e) {
$.fancybox(ez);
return false;
});
});
where .gallery-image.visible
is the main image and the .thumb-link
are the thumbnails in my Html.
Following other questions like this one using fancybox set height and width
but I actually get not visible effect on the fancybox.
Is there a different way to re-initialize fancybox configurations before calling it effectively?
EDIT:
Actually I changed my code in this way:
var fancyConfig = {'width' : 200, 'height': 300,...};
$(".gallery-image.visible").bind("click", function(e) {
$.fancybox(ez, fancyConfig);
return false;
});
and I can see some effects but no trace of thumbs….I included and can see the proper libraries for fancybox thumbnails helper.
2
Answers
Actually I found out that using the libraries used in the fiddle and not the ones I was loading in my server, makes the scripts compatible and it works. So in this way it works:
and the fiddle
I think that this piece of code does not do anything, I do not see any selector or collection of objects here:
I think you should replace
$.fancybox(ez);
with$.fancybox.open(ez, {config});