immobilien-sparrer/assets/js/product.js

20 lines
842 B
JavaScript
Raw Permalink Normal View History

2022-10-19 14:42:20 +00:00
$(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);
});
});