FancyBox disrupts all my other links.

39 views
Skip to first unread message

jill...@gmail.com

unread,
May 28, 2009, 4:08:47 PM5/28/09
to fancybox
Hi,
I want to have a fancybox gallery, but all my links respond to
fancybox, and not just the images with the same "rel=" tag.
Whenever I click on a link to another page, it opens up the second
page inside a "fancybox" box.

Can anyone help me?

Thanks!

Berns

unread,
May 29, 2009, 8:21:14 AM5/29/09
to fancybox
Lol I had this same problem last night, quite simple to fix actually!
At the stop of your code in the script section you will have something
like:

<--------------------Begin Script----------------------->
<script type="text/javascript">
$(document).ready(function() {
$("a").fancybox();
});
</script>
<--------------------End Script-------------------------->

Notice on the third line of the code it has "a" this is telling it to
initiate if you will on all links. However, if you change that to
"a#rel" it only should only initiate when the id is set to rel.

Hope this helps!

j.pitcher

unread,
May 29, 2009, 9:30:58 AM5/29/09
to fancybox
BUT—don't do that. Don't rely on id="rel"

IDs are supposed to be unique on a page. So that would mean you can't
have more than one link on the page. Not very good for a gallery. ;)

Use a class. Say, "fancyLink"...

So your script would be:

<--------------------Begin Script----------------------->
<script type="text/javascript">
$(document).ready(function() {
$("a.fancyLink").fancybox();
});
</script>
<--------------------End Script-------------------------->

And then on any anchor tag you want to use FB, give it the attribute
class="fancyLink"

Berns

unread,
May 29, 2009, 9:34:41 AM5/29/09
to fancybox
Ahhh! good to know. I really am not using it this way I am using it
like "a#inline" because I am using inline divs for youtube I just
thought it might be the answer to the question. Thank you for
correcting this though. =)

Berns

unread,
May 29, 2009, 9:43:02 AM5/29/09
to fancybox
OK! j.pitcher is a guru! You just helped me solve the issue I was
having lol... you are 110% right. I change the link itself to <a
class="inline" href="somethingunique"> (instead of having: <a
id="inline" href="somethingunique">) and then changed the top code
from "a.inline" - everything works like a charm! =)

jill...@gmail.com

unread,
May 30, 2009, 12:06:32 PM5/30/09
to fancybox
Thanks for all the help!! Made a huge difference!!!
Reply all
Reply to author
Forward
0 new messages