Commit 78e4d2844f7a9711aa84685b904d4e4b2803b47a
1 parent
db63f58c
уведомление о добавлении товара в корзину
fixed
Showing
1 changed file
with
4 additions
and
5 deletions
Show diff stats
frontend/web/js/script.js
... | ... | @@ -111,14 +111,13 @@ $( |
111 | 111 | e.preventDefault(); |
112 | 112 | var id = $(this) |
113 | 113 | .data('id'); |
114 | - var alert_id = Math.floor(Math.random() * (999 - 100 + 1)) + 100; | |
115 | 114 | basket.add(id, 1); |
116 | 115 | if ($('.alert-cart').length > 0) { |
117 | 116 | } else { |
118 | - $('body').prepend($("<div class='alert-cart alert alert-success alert-dismissible' id='alert_"+alert_id+"'>Товар добавлен в корзину.</div>")); | |
119 | - setTimeout(function(){$("#alert_"+alert_id).addClass("active");},100); | |
120 | - setTimeout(function(){$("#alert_"+alert_id).removeClass("active");},3500); | |
121 | - setTimeout(function(){$("#alert_"+alert_id).remove();},3600); | |
117 | + $('body').prepend($("<div class='alert-cart alert alert-success alert-dismissible'>Товар добавлен в корзину.</div>")); | |
118 | + setTimeout(function(){$(".alert-cart").addClass("active");},100); | |
119 | + setTimeout(function(){$(".alert-cart").removeClass("active");},3500); | |
120 | + setTimeout(function(){$(".alert-cart").remove();},3600); | |
122 | 121 | } |
123 | 122 | }); |
124 | 123 | ... | ... |