• Resolved bou3aa

    (@bou3aa)


    Hi there, my website’s loading speed is quite slow. I was wondering if there’s a way to make the animation load immediately after the button is clicked, rather than waiting for item to be add in the cart. Maybe use jQuery’s “on” method to bind a click event to the “add_to_cart” button and make the animation.

Viewing 3 replies - 1 through 3 (of 3 total)
  • villasupport

    (@villasupport)

    Hi,

    Could you please include your site URL with the problem to let us observe it?

    Best regards.

    Thread Starter bou3aa

    (@bou3aa)

    you can change this

    jQuery(document.body).on(‘added_to_cart’, function (evt, fragments, cart_hash, btn) {
    …………………….
    if (fly_to_cart) {
    let img_product = viwcaio_get_img_product(btn), sc_icon = jQuery(‘.vi-wcaio-sidebar-cart-icon-wrap’);

    by this and it will work immediately

    jQuery(document.body).on(‘click’, ‘.single_add_to_cart_button, .add_to_cart_button’, function () {
    ………………………..
    let img_product;
    if (jQuery(this).hasClass(‘single_add_to_cart_button’)) {
    img_product = jQuery(this).closest(‘.product’).find(‘.woocommerce-product-gallery__image a img’);
    } else {
    img_product = jQuery(this).siblings().children(‘img’);
    }
    let sc_icon = jQuery(‘.vi-wcaio-sidebar-cart-icon-wrap’);

    villasupport

    (@villasupport)

    Thank you for letting us know that you managed the problem. So this ticket will be closed now.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Animation load immediately after the button is clicked’ is closed to new replies.