I am building a web app image gallery using FancyBox. Right now I am appending
a custom div to the popup (image) where I need to place image specific links.
How can I replace the content of the tools div everytime I click next to another image?
Or better yet, is it possible to append this div from inside the popup?
This is my code:
$(".iframe").fancybox ({
afterShow: function () {
var toolbar = '<div id="tools">LINKS COME HERE</div>';
$(".fancybox-inner").append(toolbar);
},
maxWidth : 1200,
maxHeight : 550,
width : '90%',
height : '90%',
autoSize : false,
closeBtn : false,
openEffect : 'none',
closeEffect : 'none',
nextEffect: 'none',
prevEffect: 'none',
padding: 0,
scrolling: 'no'
});
I think you can create the content (of the
divto be appended) for each image in a separated (hidden) section of your document likeThe structure above assumes that you should have an equal number of images for each
divin your gallery like:Additionally you can create a css selector for the appended
divwithin your css stylesheet rather than using the.css()method (as suggested in your other question) like:…or the style settings you need.
Then pull the content of each
divand append it dynamically to the corresponding image while navigating through the gallery.using the
afterShowcallback option, you could do: