Scroll to top after product variation selection

[ad_1]

Hi,

Thank you for reaching out to us.

Yes, you may add this code to the JS file in your theme or in custom script:

jQuery(document).ready(function ($) {
    jQuery('.single-product form.variations_form.vi_wpvs_variation_form').on('show_variation', function (event, v) {
        if (jQuery(window).width() <= 600 && v && v.hasOwnProperty('image_id') && jQuery(this).attr('current-image') != v.image_id) {
            window.scrollTo({top: parseInt(jQuery('.woocommerce-product-gallery').offset().top), behavior: 'smooth'});
        }

    });
});

Best regards.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer