Skip to content

Instantly share code, notes, and snippets.

@chadsten
Last active August 29, 2015 14:07
Show Gist options
  • Save chadsten/566384481d4f16946d83 to your computer and use it in GitHub Desktop.
Save chadsten/566384481d4f16946d83 to your computer and use it in GitHub Desktop.
// If component already has a slice
if(componentArray[i].hasOwnProperty('slice')){
// Fade out current slice
componentArray[i].slice.fadeOut(200,function(){
// Swipe slice source
this.src = '/sites/default/files/generated_image/' + view + '_' + component_id + '-' + swatch_id + '.png';
// Fade back in
jQuery(this).fadeIn(200);
});
} else {
// Create new slice
componentArray[i].slice = jQuery('<img src="/sites/default/files/generated_image/' + view + '_' + component_id + '-' + swatch_id + '.png" style="position: absolute; z-index: ' + i+2 + '; top: 0; left: 0;">');
// Append to dom and fade in
componentArray[i].slice.hide().appendTo(boat_container).fadeIn(200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment