Fancybox title and description

Fancybox has the “title=” attribute, caption, data-caption doesn’t work

I wrote a paragraph inside the “title” attribute but I want a different method, how to do so?

After doing some digging through the source you can alter the template by using the “tpl” option.

tpl: {
  wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
  image    : '<img class="fancybox-image" src="{href}" alt="" />',
  iframe   : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
  error    : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
  closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
  next     : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
  prev     : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>',
  loading  : '<div id="fancybox-loading"><div></div></div>'
},

you can find more information here and looking at the source on github.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.