animate count
parent
4315aaf145
commit
2c6429d48c
|
@ -89,6 +89,15 @@
|
|||
});
|
||||
$('#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);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
|
||||
<style>
|
||||
body{
|
||||
background-color: rgba(218, 211, 227, 0.65);
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<div class="col-1 text-end">
|
||||
<a href="" data-bs-toggle="modal" data-bs-target="#ShoppingCart" class="position-relative">
|
||||
<svg style="fill: white; width: 30px; margin-top: 6px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M352 128C352 57.42 294.579 0 224 0 153.42 0 96 57.42 96 128H0v304c0 44.183 35.817 80 80 80h288c44.183 0 80-35.817 80-80V128h-96zM224 48c44.112 0 80 35.888 80 80H144c0-44.112 35.888-80 80-80zm176 384c0 17.645-14.355 32-32 32H80c-17.645 0-32-14.355-32-32V176h48v40c0 13.255 10.745 24 24 24s24-10.745 24-24v-40h160v40c0 13.255 10.745 24 24 24s24-10.745 24-24v-40h48v256z"/></svg>
|
||||
<span class="position-absolute top-0 start-90 translate-middle badge rounded-pill bg-danger" style="display: none;" id="count-products-in-bag">0</span>
|
||||
<span class="position-absolute top-10 start-90 badge rounded-pill bg-danger" style="display: none; right: -10px;" id="count-products-in-bag">0</span>
|
||||
</a>
|
||||
<div class="modal fade" id="ShoppingCart" tabindex="-1" aria-labelledby="ShoppingCart" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
|
|
Loading…
Reference in New Issue