Home › Forums › WoodMart support forum › Variation Image Gallery issue › Reply To: Variation Image Gallery issue
September 8, 2022 at 4:01 pm
#402330
dadi
Participant
Hello,
I fixed the issue by adding little jquery code:
<script>
(function($){
$(document).ready(function(){
let isRunning = false;
$('.variable-item').click(function(){
if(isRunning) return;
let element = $(this);
window.setTimeout(function(){
let el = element.parents('tbody');
let classnames = element.attr('class');
$(el).find('tr').each(function(){
let sel = $(this).find('li.selected:first');
let doubleClick = true;
if(!sel.length){
sel = $(this).find('li:not(.disabled):not(.no-stock):first');
doubleClick = false;
}
if(classnames !== sel.attr('class')){
isRunning = true;
sel.click();
if(doubleClick){
sel.click();
}
window.setTimeout(function(){
isRunning = false;
},500);
}
});
},500);
});
});
})(jQuery);
</script>