Reputation: 6346
I have a fancybox that gets opened via:
$('.fancybox').fancybox({
type: 'iframe',
fitToView : false,
autoSize : false,
height : 550,
width : 650,
beforeClose: function () {
d = new Date();
var imgObj = $('.fancybox').siblings('img');
var imgSrc = imgObj.attr("src");
imgObj.attr("src", imgSrc+"?"+d.getTime());
}
});
As you can see in the beforeClose
function I am trying to target a sibling image of the link that was clicked and reload the image by appending the time as a querystring.
The above code works, however it only works if there is 1 fancybox on the page. If there are more than 1 (which is what I'm wanting to do), then it reloads all the images on the page to the one next to the link that was clicked.
Is there a way I can target the link I clicked to open fancybox from within the beforeClose
function?
I can't find anything on the fancybox documentation about how to do this.
Upvotes: 0
Views: 497