Skip to content

Instantly share code, notes, and snippets.

@tessguefen
Last active August 29, 2015 14:07
Show Gist options
  • Save tessguefen/8a4e24dbea335b229d08 to your computer and use it in GitHub Desktop.
Save tessguefen/8a4e24dbea335b229d08 to your computer and use it in GitHub Desktop.
Colorbox pop up, with titles and additional images -- Example
<mvt:item name="customfields" param="Read_Product_Code( l.settings:product:code, 'main_img_title, add_title1, add_title2, add_title3, add_title4, add_title5', l.settings:customfields )" />
ImageMachine.prototype.ImageMachine_Generate_Thumbnail = function( thumbnail_image, main_image, closeup_image, type_code )
{
var thumbnail, span, img, atag;
thumbnail = document.createElement( 'li' );
span = document.createElement( 'span' ); // to vertically center the thumbnail images
atag = document.createElement( 'a' );
thumbnail.appendChild( span );
if ( typeof( thumbnail_image ) == 'string' && thumbnail_image.length > 0 )
{
img = document.createElement( 'img' );
img.src = thumbnail_image;
atag.href = closeup_image;
atag.className = 'vlightbox1';
if (type_code == 'main') {
atag.title = '&mvt:product:customfield_values:customfields:main_img_title;';
} else if (type_code == 'add_1') {
atag.title = '&mvt:product:customfield_values:customfields:add_title1;';
} else if (type_code == 'add_2') {
atag.title = '&mvt:product:customfield_values:customfields:add_title2;';
} else if (type_code == 'add_3') {
atag.title = '&mvt:product:customfield_values:customfields:add_title3;';
} else if (type_code == 'add_4') {
atag.title = '&mvt:product:customfield_values:customfields:add_title4;';
} else if (type_code == 'add_5') {
atag.title = '&mvt:product:customfield_values:customfields:add_title5;';
}
atag.appendChild( img );
thumbnail.appendChild( atag );
}
return thumbnail;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment