Home Forums WoodMart support forum Change main image on color swatch hover on category page

Change main image on color swatch hover on category page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #307912

    morena_swim
    Participant

    we would like the images to change on hover and not on click
    https://morenad.co.il/product-category/swimwear-on-sale/
    for exmaple, the first swimsuit on the left – has 3 images that change only on click.
    thanks ahead.
    none of the category layouts / styles enables it.
    are we missing an option or is there a snippet to enable it?

    Attachments:
    You must be logged in to view attached files.
    #308016

    Artem Temos
    Keymaster

    Hi,

    Try to add the following code snippet to the Custom JS area on document ready in Theme Settings to fix this issue.

    function swatch_hover(){
    	jQuery('.swatch-on-grid').on('hover mouseover', function(){
    		if(!jQuery(this).hasClass('active-swatch')) {
    			jQuery(this).trigger('click');
    		}
    	});
    }
    swatch_hover();
    jQuery(document).on('pjax:complete', function() {
    	 swatch_hover();
    });

    Kind Regards

    #308022

    morena_swim
    Participant

    Thank you very much, works perfectly

    #308027

    Artem Temos
    Keymaster

    Great, you are welcome!

Viewing 4 posts - 1 through 4 (of 4 total)