Skip to content

Instantly share code, notes, and snippets.

@tessguefen
Last active August 29, 2015 14:07
Show Gist options
  • Save tessguefen/40ae4b20dd292d1542ca to your computer and use it in GitHub Desktop.
Save tessguefen/40ae4b20dd292d1542ca to your computer and use it in GitHub Desktop.
External Zoom Image Machine
== Custom.js ==
$('#thumbnails img').on('click', function() {
$('a.zoom').attr('href', $(this).attr('data-large'));
$('a.zoom').easyZoom({
preload: '<p class="preloader">Loading the image</p>',
parent: '.product-main'
});;
});
$('a.zoom').easyZoom({
preload: '<p class="preloader">Loading the image</p>',
parent: '.product-main'
});
== Image Machine ==
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
thumbnail.appendChild( span );
if ( typeof( thumbnail_image ) == 'string' && thumbnail_image.length > 0 )
{
img = document.createElement( 'img' );
img.src = thumbnail_image;
img.setAttribute('data-large', closeup_image);
thumbnail.appendChild( img );
}
return thumbnail;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment