Posted By

davidcfox on 01/25/11


Tagged

jquery fancybox


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

virendrakryadav


FancyBox Split Title Attribute and Format Output


 / Published in: jQuery
 

This is the code necessary to grab the title attribute from the link/images selected and then parse it for use in the title field of a FancyBox popup.

  1. FancyBox Split Title Attribute and Format Output
  2.  
  3. jQuery('#selector').fancybox({
  4. 'titlePosition' : 'inside',
  5. 'titleFormat' :
  6. function(title, currentArray, currentIndex, currentOpts) {
  7. var splitTitle = title.split('-');
  8. //return your text in whatever format you need
  9. return '<div style="color:red;">' + splitTitle[0] + '</div>';
  10. }
  11. });

Report this snippet  

You need to login to post a comment.