lumino-showroom/assets/js/product.js

20 lines
842 B
JavaScript

$(window).on('load', function(){
$('#btn-check-out').click(function(){
let productId = $(this).attr("data-id");
addToBag(productId);
window.location.replace($('meta[name="checkout"]').attr('content'));
});
$('#btn-add-to-bag').click(function(){
let productId = $(this).attr("data-id");
let parentElement = $('#count-products-in-bag').parent();
let copyElemetn = $('#count-products-in-bag').clone();
copyElemetn.attr('id', '');
copyElemetn.appendTo(parentElement);
$('#count-products-in-bag').addClass('animate__animated animate__backInUp');
$('#count-products-in-bag').on('animationend', function(){
$('#count-products-in-bag').removeClass('animate__animated animate__backInUp');
copyElemetn.remove();
});
addToBag(productId);
});
});