Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- thumbnails = $('img[src*="/products/"]').not(':first');
- if (thumbnails.size()) {
- thumbnails.bind('click', function() {
- var image = $(this).attr('src').split('?')[0].replace(/(_160x\.)|(_thumb\.)|(_small\.)|(_compact\.)|(_medium\.)|(_large\.)|(_grande\.)/,'.');
- if (typeof variantImages[image] !== 'undefined') {
- productOptions.forEach(function (value, i) {
- optionValue = variantImages[image]['option-'+i];
- if (optionValue !== null && $('.single-option-selector:eq('+i+') option').filter(function() { return $(this).text() === optionValue }).length) {
- $('.single-option-selector:eq('+i+')').val(optionValue).trigger('change');
- }
- });
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement