call fancybox from onClick..

478 views
Skip to first unread message

huglester

unread,
Dec 28, 2009, 3:30:35 AM12/28/09
to fancybox
Hello everyone.

Thanks for this nice lib, but I came into some problems...
Currently I'm using the code:
$("a.group").fancybox({ 'hideOnContentClick': false, 'zoomSpeedIn':
300, 'zoomSpeedOut': 300, 'overlayShow': false });

and it is working nice, but.... I want to add a button:
<a href="#" onclick="...">View gallery</a>, which would run the
appropriate gallery. and don't know how is it done :(

I tried this,
$("a.emulateclick").click(function () {
var rel = $(this).attr('id');
$("a").attr('rel', rel).click();
});

the id of the a.emulateclick was holding rel name of the fancybox
gallery...
It emulates lick, start gallery, but does not allow you to swich
photos, close fancybox.. etc.

so I thought maybe the is something like:
onclick=fanxybox.start('rel-name-of-the-gallery');

I'm sure somebody already solved this issue!:)
thanks!

cheers,
Jaroslav

Janis

unread,
Jan 1, 2010, 2:50:47 PM1/1/10
to fancybox
You could try $("a.group:first").trigger('click');

Janis

huglester

unread,
Jan 2, 2010, 7:11:28 AM1/2/10
to fancybox
Thanks mate,
I think I didn't get responce by email about your post.. So I visited
it :)

but your reply did help me :)
thank you so much!:)
I was playing with $("a.group").fancybox().trigger('click'); - with
no luck..
I was able only to bind only 1 photo, now I understand why :)

Thank you very much and happy new year!

Reply all
Reply to author
Forward
0 new messages