FancyBox Split Title Attribute and Format Output


/ Published in: jQuery
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.