Sha256: ae0b083d045b6f5a53498806ca8205cdb5a7105e34aaa5af78ca89380761a2d5
Contents?: true
Size: 975 Bytes
Versions: 2
Compression:
Stored size: 975 Bytes
Contents
var show_variant_images = function(variant_id) { $('li.vtmb').hide(); $('li.vtmb-' + variant_id).show(); var currentThumb = $('#' + $("#main-image").data('selectedThumbId')); // if currently selected thumb does not belong to current variant, nor to common images, // hide it and select the first available thumb instead. if(!currentThumb.hasClass('vtmb-' + variant_id)) { //var thumb = $($('ul.thumbnails li:visible').eq(0)); var thumb = $($("ul.thumbnails li.vtmb-" + variant_id + ":first").eq(0)); if (thumb.length == 0) { thumb = $($('ul.thumbnails li:visible').eq(0)); } var newImg = thumb.find('a').attr('href'); $('ul.thumbnails li').removeClass('selected'); thumb.addClass('selected'); $('#main-image img').attr('src', newImg); $("#main-image").data('selectedThumb', newImg); $("#main-image").data('selectedThumbId', thumb.attr('id')); } } var show_all_variant_images = function() { $('li.vtmb').show(); }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_variant_options-0.4.1 | app/assets/javascripts/store/product_variant_options.js |
spree_variant_options-0.4.0 | app/assets/javascripts/store/product_variant_options.js |