Not working when appending links via jquery

966 views
Skip to first unread message

Jack Saxe-Staral

unread,
Apr 16, 2010, 6:01:01 PM4/16/10
to fancybox
Ok. I've been messing with this for two days and for the life of me I
can't figure it out. Any help would be much appreciated as I couldn't
seem to find a similar problem anywhere in the group. Anyway here it
is -

Basically I'm pulling all of my info from an xml file and then
appending it to a div on my page. All of this works fine and dandy.
The problem is that fancybox won't open - the link just opens the
image in the window despite it having the rel="example_group". If I
put example code directly into the div tag the fancybox works fine.
As soon as I copy that text and add it to my append function it's a no
go. Here is a link to my development page so you can see what I'm
talking about: http://davidbayerphotography.com/gallery/ Thanks in
advance,
-j

--
You received this message because you are subscribed to the Google Groups "fancybox" group.
To post to this group, send email to fanc...@googlegroups.com.
To unsubscribe from this group, send email to fancybox+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fancybox?hl=en.

JFK

unread,
Apr 17, 2010, 9:51:21 PM4/17/10
to fancybox

Janis

unread,
Apr 18, 2010, 8:33:52 AM4/18/10
to fancybox
Just attach fancybox after adding images to document. Isn`t this
obvious?

Janis

JFK

unread,
Apr 18, 2010, 10:26:15 PM4/18/10
to fancybox
>Just attach fancybox after adding images to document
@Janis
It was my first thought and actually I tested it that way but when you
click the inline link, fancybox will be called normally and you will
be able to navigate through all the images regardless their links were
inline or added (prepend) later on .... however, if you click on any
of the added links (prepend), the images will open in a new window
though.

I gave a livequery plug-in a try and now fancybox is fired normally
clicking on either the inline links or the added links

I wonder if I missed something to make it work without using livequery
in this case

potion_maker

unread,
Apr 19, 2010, 3:36:21 PM4/19/10
to fancybox
JFK, Janis
Thanks to you both for your help. I also could not get fancybox going
by attaching fancybox later. So I took a swing at using livequery as
per JFK's suggestion and Janis' instructions on the following page.
Wound up with this -

$("[rel=example_group]").livequery(function(){
$this.fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'titlePosition' : 'over',
'titleFormat' : function(title, currentArray, currentIndex,
currentOpts) {
return '<span id="fancybox-title-over">Image ' + (currentIndex +
1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' +
title : '') + '</span>';
}
});
});

Am I using livequery in the wrong place? Thanks again for your help.
Message has been deleted
Message has been deleted

potion_maker

unread,
Apr 19, 2010, 8:39:39 PM4/19/10
to fancybox
Silly mistake. The above code works I simply forgot to wrap my $
(this) in parenthesis. Thanks again JFK and Janis
Reply all
Reply to author
Forward
0 new messages