titleFromAlt

1,860 views
Skip to first unread message

JFK

unread,
Oct 27, 2010, 9:59:48 PM10/27/10
to fancybox
October 27th, 2010
Back in April 2010 I published an explanation about how title works in
fancybox in a normal scenario:
http://groups.google.com/group/fancybox/browse_thread/thread/7f2777fca8335aa4/

v1.3.2 introduced a new option (not documented yet on the website as
today):
titleFromAlt

How to use this function:

1). if you are using thumbnails, then the alt attribute (that you want
to use as title) MUST be on the <img> tag (the thumbnail) like:
<a class="fancyimage" href="image.jpg"><img src="thumbnail" alt="my
alt as title" /></a>

2). if you are using a text link, then the alt attribute should be in
the <a> tag (this is not semantically correct -arguably- but we are
not trying to be purist, are we?) like:
<a class="fancyimage" href="image.jpg" alt="my alt as title">open
image</a>

3). In EITHER case, the option titleFromAlt has to be set to true,
like:
<script type="text/javascript">
$(document).ready(function() {
$("a.fancyimage").fancybox({
'titleFromAlt':true
});
});

</script>

RavanH

unread,
Oct 28, 2010, 7:58:52 PM10/28/10
to fancybox
Thanks for these instructions :)

However, this is exactly what I have been testing with and what does
not seem to work on my site... Can it be that if the wrapped <img>
also has a title set, it goes wrong? Or if the wrapping <a> has a
title tag? Just thinking out loud here but I'll do some more tests to
see if I can get it working (or find the cause) and report back.

Another question: since the description about Title on
http://groups.google.com/group/fancybox/browse_thread/thread/7f2777fca8335aa4/
does not seem to apply to the latest version 1.3.2, could you please
explain how it works in this new version (when not using
'titleFromAlt') please ? Thanks :)


On 28 okt, 03:59, JFK <jfk.d...@gmail.com> wrote:
> October 27th, 2010
> Back in April 2010 I published an explanation about how title works in
> fancybox in a normal scenario:http://groups.google.com/group/fancybox/browse_thread/thread/7f2777fc...

JFK

unread,
Oct 28, 2010, 9:06:36 PM10/28/10
to fancybox
all the examples in
http://groups.google.com/group/fancybox/browse_thread/thread/7f2777fca8335aa4/
are still valid for v1.3.2
the only condition is to set 'titleFromAlt' to TRUE (default value is
false) like:
<script type="text/javascript">
$(document).ready(function() {
$("a.imagenes").fancybox({
'titleFromAlt':true
});
});
</script>

On Oct 28, 4:58 pm, RavanH <ravanha...@gmail.com> wrote:
> Thanks for these instructions :)
>
> However, this is exactly what I have been testing with and what does
> not seem to work on my site... Can it be that if the wrapped <img>
> also has a title set, it goes wrong? Or if the wrapping <a> has a
> title tag? Just thinking out loud here but I'll do some more tests to
> see if I can get it working (or find the cause) and report back.
>
> Another question: since the description about Title onhttp://groups.google.com/group/fancybox/browse_thread/thread/7f2777fc...
Reply all
Reply to author
Forward
0 new messages