jQuery(function ($) {
function animateButton(button, animationClass, otherButton) {
$(button).addClass(animationClass);
// Remove the class when the animation ends and set timeout to animate the other button
$(button).one("animationend", function () {
$(this).removeClass(animationClass);
setTimeout(function () {
animateButton(
otherButton,
$(otherButton).is(".single_add_to_cart_button")
? "nm-cart-btn-animation"
: "nm-whatsapp_order-btn-animation",
button
);
}, 2000);
});
}
// Start the first animation
animateButton(
".single_add_to_cart_button",
"nm-cart-btn-animation",
"form.cart .ctc_woo_place > .ht-ctc-style-8"
);
});