I think you can create the content (of the div
to be appended) for each image in a separated (hidden) section of your document like
<div id="appendContent" style="display: none;">
<div>content with links to be appended to the first image</div>
<div>content with links to be appended to the second image</div>
<div>content with links to be appended to the third image</div>
... etc.
</div>
The structure above assumes that you should have an equal number of images for each div
in your gallery like:
<a href="image01.jpg" class="fancybox" rel="gallery">image 01</a>
<a href="image02.jpg" class="fancybox" rel="gallery">image 02</a>
<a href="image03.jpg" class="fancybox" rel="gallery">image 03</a>
etc.
Additionally you can create a css selector for the appended div
within your css stylesheet rather than using the .css()
method (as suggested in your other question) like:
#tools {
position: absolute;
z-index: 99999;
bottom: 0px;
height: 20px;
border: 1px solid #ccc;
background: #fff;
width: 100%;
}
...or the style settings you need.
Then pull the content of each div
and append it dynamically to the corresponding image while navigating through the gallery.
using the afterShow
callback option, you could do:
$(document).ready(function() {
$(".fancybox").fancybox({
afterShow: function(){
var toolbar = "<div id='tools'>" + $("#appendContent div").eq(this.index).html() + "</div>";
$(".fancybox-inner").append(toolbar);
}
}); // fancybox
}); // ready
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…