Created
September 22, 2013 14:45
-
-
Save artboard-studio/6660612 to your computer and use it in GitHub Desktop.
update woocommerce main product image on thumbnail click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
"use strict"; | |
$(document).on('click','.thumbnails .zoom', function(){ | |
var photo_fullsize = $(this).find('img').attr('src').replace('-150x180',''); | |
$('.woocommerce-main-image img').attr('src', photo_fullsize); | |
return false; | |
}); | |
}); |
This worked for me in WordPress 4.6
$('body').on('click','.thumbnails img', function(){
var thumb_fullsize = $(this).attr('src').replace('-180x180','');
thumb_srcset = $(this).attr('srcset');
$('.images > img').attr('src', thumb_fullsize);
$('.images > img').attr('srcset', thumb_srcset);
return false;
});
@marcelo2605
where should I enter your code? should I make one new file of js?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is not working WordPress 4.5