Return to Snippet

Revision: 40032
at January 25, 2011 08:57 by davidcfox


Updated Code
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>';
}
});

Revision: 40031
at January 25, 2011 07:10 by davidcfox


Initial Code
FancyBox Split Title Attribute and Format Output

jQuery('#selector').fancybox({
'titlePosition' : 'inside',
'titleFormat' : 
 function(title, currentArray, currentIndex, currentOps) {
    var splitTitle = jQuery('').attr('title').split('-');
    //return your text in whatever format you need   
    return '<div style="color:red;">' + splitTitle[0] + '</div>';
}
});

Initial URL

                                

Initial Description
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.

Initial Title
FancyBox Split Title Attribute and Format Output

Initial Tags
jquery

Initial Language
jQuery