diff --git a/frontend/web/css/style.css b/frontend/web/css/style.css index 15053ed..f4c1cbd 100755 --- a/frontend/web/css/style.css +++ b/frontend/web/css/style.css @@ -4639,4 +4639,18 @@ a.list-group-item.active > .badge, -ms-transform: rotate(360deg); transform: rotate(360deg); } +} + +.alert-cart{ + position: fixed; + z-index: 1001; + width: 50%; + left: 25%; + top: -75px; + box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.0); + transition: 0.3s; +} +.alert-cart.active{ + top: 30px; + box-shadow: 0px 0px 25px rgba(0, 0, 0, 0.3); } \ No newline at end of file diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index 01842c6..884d85a 100755 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -111,7 +111,15 @@ $( e.preventDefault(); var id = $(this) .data('id'); + var alert_id = Math.floor(Math.random() * (999 - 100 + 1)) + 100; basket.add(id, 1); + if ($('.alert-cart').length > 0) { + } else { + $('body').prepend($("
Товар добавлен в корзину.
")); + setTimeout(function(){$("#alert_"+alert_id).addClass("active");},100); + setTimeout(function(){$("#alert_"+alert_id).removeClass("active");},3500); + setTimeout(function(){$("#alert_"+alert_id).remove();},3600); + } }); $(document) -- libgit2 0.21.4