fancybox icon indicating copy to clipboard operation
fancybox copied to clipboard

Using img:alt instead of a:title to store the title possible?

Open petze opened this issue 14 years ago • 3 comments

In your code you use the title attribute to store the title. The problem with this method is that the browser automatically displays the help tag when you hover the mouse over the image. In my gallery, I'm using CSS to display a nicly formatted label for that, so I do not want the browser default. I tried to use the ALT attribute of the image instead to store the title, but I can't find what I need to change in the code.

I don't really find where you grab the title. You are using F.current.title, but I can't find where you fill it with the title.

petze avatar Jan 28 '12 10:01 petze

You can use callback to customize title. Simple example -

$('.fancybox').fancybox({
    beforeLoad : function() {
        this.title = $(this.element).find('img').attr('alt');
    }
});

fancyapps avatar Jan 31 '12 10:01 fancyapps

I'm having trouble making this work... I just put it in script tags within the HEAD, yes? Otherwise where does it go?

mandapop avatar Feb 27 '14 22:02 mandapop

Never mind! I accidentally put the script BEFORE the initial Fancybox script... So then I added the script after Fancybox was initialized and now it works. LIFE IS GOOD, thanks. :)

mandapop avatar Feb 27 '14 23:02 mandapop