Creating an Image Gallery with Manual Fancybox Call

194 views
Skip to first unread message

rpessagno

unread,
May 24, 2012, 3:13:48 PM5/24/12
to fancybox
I would like to use Fancybox for an image gallery, using the built-in
next and previous buttons to go through the slides. I'm manually
firing Fancybox because I want to be able to use variables within my
options. The Fancybox overlay opens fine, but now the next/prev
buttons do not work.

$('.img-cta').click(function() {
var url = $(this).attr('href');
var name = $(this).attr('name');
$.fancybox({
content: '<img src="'+url+'" class="overlay-img" />',
title: '<a href="'+name+'" class="overlay-download"></a>',
prevEffect: 'fade',
nextEffect: 'fade',
loop: false,
padding: 60
}
});
return false;
});


Any suggestions on how to get the gallery working again?

JFK

unread,
May 24, 2012, 5:45:14 PM5/24/12
to fancybox
the manual method doesn't allow you to have galleries from links
you would need to set the gallery inside the script
check
http://groups.google.com/group/fancybox/browse_thread/thread/c8000121907eb362/
for more

rpessagno

unread,
May 24, 2012, 6:10:35 PM5/24/12
to fancybox
Thanks for the response. That article definitely helped clear things
up. Fancybox's documentation wasn't very good at illustrating how to
use the [gallery] area. I found a workaround, though. I used the
onUpdate function to call variables and find elements in the HTML.

On May 24, 2:45 pm, JFK <jfk.d...@gmail.com> wrote:
> the manual method doesn't allow you to have galleries from links
> you would need to set the gallery inside the script
> checkhttp://groups.google.com/group/fancybox/browse_thread/thread/c8000121...
> for more

JFK

unread,
May 24, 2012, 8:04:52 PM5/24/12
to fancybox
if you are using fancybox v2.x and HTML5 DOCTYPE, you can pass
whatever you want using the attribute "data-*"

check http://stackoverflow.com/a/9529889/1055987 for examples
Reply all
Reply to author
Forward
0 new messages