Loading title from element other than title

18 views
Skip to first unread message

JC

unread,
Jan 25, 2009, 10:38:59 AM1/25/09
to Slimbox
I am using the Slimbox in a gallery and want to disable the image
tooltip when hovering the mouse over the image. I have read the api
about loading the Slimbox title from another tag than the title tag.

I have tried using several different tags which fail to load and only
the title tag will load the info into the Slimbox title.

I have used the code below without success:

Slimbox.scanPage = function() {
var links = $$("a").filter(function(el) {
return el.rel && el.rel.test(/^lightbox/i);
});
$$(links).slimbox({
loop: true,
overlayOpacity: 0.6,
}, function(el) {
return [el.href, el.alt];
}, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel ==
el.rel));
});
};

Any help would be appreciated.

JC

Chris

unread,
Jan 27, 2009, 12:44:25 PM1/27/09
to Slimbox
"alt" is an attribute which is only available for img tags, for
example a thumbnail image located inside the link.

So, if you are using thumbnails inside your links, you can use the
following linkMapper function to grab the description from the "alt"
attribute of the thumbnail if no "title" attribute is available on the
link:

function(el) {
return [el.href, el.title || el.firstChild.alt];
}

Also, I think there is a way to disable the tooltips display using
javascript, but I don't know exactly how.

JC

unread,
Jan 27, 2009, 5:25:10 PM1/27/09
to Slimbox
Just got back to it today and located an error on my part.

Great script and thanks Chris for the quick response.

JC
Reply all
Reply to author
Forward
0 new messages