/ 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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
FancyBox Split Title Attribute and Format Output jQuery('#selector').fancybox({ 'titlePosition' : 'inside', 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { var splitTitle = title.split('-'); //return your text in whatever format you need return '<div style="color:red;">' + splitTitle[0] + '</div>'; } });