This source code below was posted by Cristiano G. Carvalho in answer to the question: calling fancybox gallery with other link made by another user.
<div class="details_gallery">
<a href="#" class="manualfancybox">Manual Call Fancybox</a>
<div class="details_gallery_min">
<a rel="details" href="max/1.jpg" class="fancybox"><img src="min/1.jpg" alt="" /></a>
<a rel="details" href="max/2.jpg" class="fancybox"><img src="min/2.jpg" alt="" /></a>
<a rel="details" href="max/3.jpg" class="fancybox"><img src="min/3.jpg" alt="" /></a>
<a rel="details" href="max/4.jpg" class="fancybox"><img src="min/4.jpg" alt="" /></a>
</div>
</div>
<script>
$(document).ready(function(){
$(".manualfancybox").click(function() {
var photos = new Array();
$(".details_gallery_min a").each(function(){
href = $(this).attr("href");
title = $(this).attr("title");
photos.push({'href': href, 'title': title})
});
jQuery.fancybox(photos ,
{ 'transitionIn' : 'elastic',
'easingIn' : 'easeOutBack',
'transitionOut' : 'elastic',
'easingOut' : 'easeInBack',
'opacity' : false,
'titleShow' : true,
'titlePosition' : 'over',
'type' : 'image',
'titleFromAlt' : true
}
);
});
});
</script>
And it DOES work... if you have ONLY ONE gallery (.details_gallery_min in the example).
I've tried to change
$(".details_gallery_min a").each(function(){
to
$(".galleryone a, .gallerytwo a").each(function(){
but it only works for ".galleryone a", when I click on the link that calls "gallerytwo" it opens "galleryone". My HTML code is correct.
My question is:
What if I have multiple links opening different galleries and I want to use the same behaviors (transition, easing, etc.) to all galleries?