Commit 5e4ecece3e000a832aad81f87abd0989d5763dd0
1 parent
f4ab266e
qwerty
Showing
7 changed files
with
54 additions
and
21 deletions
Show diff stats
app/views/layouts/main.php
... | ... | @@ -81,8 +81,8 @@ $this->registerJsFile(Yii::$app->request->baseUrl.'/js/new-basket.js',['position |
81 | 81 | |
82 | 82 | </div> |
83 | 83 | |
84 | -<div id="overlay" style="display: block;"></div> | |
85 | -<div id="new-basket-modal" class="new-basket-modal" style="display: block"> | |
84 | +<div id="overlay" style="display: none;"></div> | |
85 | +<div id="new-basket-modal" class="new-basket-modal" style="display: none"> | |
86 | 86 | <div class="site"> |
87 | 87 | <div class="style basket-modal-wr"> |
88 | 88 | <div class="style title-basket-modal"> |
... | ... | @@ -166,10 +166,16 @@ $this->registerJsFile(Yii::$app->request->baseUrl.'/js/new-basket.js',['position |
166 | 166 | </div> |
167 | 167 | </div> |
168 | 168 | |
169 | - <div class="style buttons-b-wr"> | |
169 | + <div class="style buttons-b-wr hidden-xs"> | |
170 | 170 | <a class="link-to-basket" href="#">оформить заказ</a> |
171 | 171 | <a class="close-basket" href="#">продолжить покупки</a> |
172 | 172 | </div> |
173 | + | |
174 | + <div class="style buttons-b-wr visible-xs hidden"> | |
175 | + <a class="close-basket" href="#">продолжить покупки</a> | |
176 | + <a class="link-to-basket" href="#">оформить заказ</a> | |
177 | + </div> | |
178 | + | |
173 | 179 | </div> |
174 | 180 | </div> |
175 | 181 | </div> | ... | ... |
app/views/products/_product.php
... | ... | @@ -30,5 +30,5 @@ use yii\helpers\Url; |
30 | 30 | <p class="rubric"><?=$item->catalog->name?></p> |
31 | 31 | <a href="<?=Url::to(['products/show','translit_rubric'=>$item->catalog->translit,'translit'=>$item->translit,'id'=>$item->id])?>" class="name"><?=$item->name?></a> |
32 | 32 | <div class="cost">цена <?=$item->cost->cost?> грн</div> |
33 | - <a href="<?=Url::to(['products/show','translit_rubric'=>$item->catalog->translit,'translit'=>$item->translit,'id'=>$item->id])?>" class="buy">Купить</a> | |
33 | + <a href="<?=Url::to(['products/show','translit_rubric'=>$item->catalog->translit,'translit'=>$item->translit,'id'=>$item->id])?>" class="buy new-btn-modal-basket">Купить</a> | |
34 | 34 | </div> | ... | ... |
app/views/products/show.php
... | ... | @@ -157,7 +157,7 @@ $this->registerJs(" |
157 | 157 | </div> |
158 | 158 | <div class="boy_box"> |
159 | 159 | <input type='hidden' id='product_id' /> |
160 | - <a href="#" rel='product' class="buy fr modal-link" data-form="new-basket-modal">Купить</a> | |
160 | + <a href="#" rel='product' class="buy fr basket-card">Купить</a> | |
161 | 161 | <div class="fl txtfb">цена <span id="cost">0</span> грн</div><div class="both"></div> |
162 | 162 | </div> |
163 | 163 | <div class="info"> | ... | ... |
app/widgets/views/_product_view.php
css/new-style.scss
... | ... | @@ -248,7 +248,17 @@ $greenColor: #59a926; |
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | +.hidden { | |
252 | + display: none !important; | |
253 | +} | |
254 | + | |
251 | 255 | @media (max-width: 767px) { |
256 | + .visible-xs { | |
257 | + display: block !important; | |
258 | + } | |
259 | + .hidden-xs { | |
260 | + display: none !important; | |
261 | + } | |
252 | 262 | .table-basket { |
253 | 263 | |
254 | 264 | tr { |
... | ... | @@ -282,4 +292,7 @@ $greenColor: #59a926; |
282 | 292 | float: none; |
283 | 293 | } |
284 | 294 | } |
295 | + .basket-modal-wr { | |
296 | + border-radius: 0; | |
297 | + } | |
285 | 298 | } |
286 | 299 | \ No newline at end of file | ... | ... |
js/basket.js
1 | 1 | (function($){ |
2 | 2 | |
3 | 3 | $.fn.basket = function(callerSettings) { |
4 | - | |
4 | + | |
5 | 5 | var basket_id = this; |
6 | 6 | |
7 | - var find_products = function(){ | |
8 | - $("a[rel~='product']").each(function (i) { | |
9 | - $(this).bind('click',function(){ | |
7 | + var find_products = function(){ | |
8 | + $("a[rel~='product']").each(function (i) { | |
9 | + $(this).bind('click',function(){ | |
10 | 10 | var rel = $(this).attr('rel'); |
11 | 11 | var id = $('#product_id').val(); |
12 | 12 | var count = $('#count').val(); |
... | ... | @@ -19,16 +19,16 @@ |
19 | 19 | }) |
20 | 20 | }); |
21 | 21 | }; |
22 | - | |
22 | + | |
23 | 23 | var go_product = function(data){ |
24 | 24 | var product_id = data.product_id; |
25 | 25 | $.post("/basket/add/", data , |
26 | - function(data){ | |
26 | + function(data){ | |
27 | 27 | //alert_msg("Товар добавлен<br /> в корзину",product_id); |
28 | 28 | start_basket(); |
29 | - }); | |
29 | + }); | |
30 | 30 | }; |
31 | - | |
31 | + | |
32 | 32 | var start_basket = function(){ |
33 | 33 | $.post("/basket/info/", |
34 | 34 | function(data){ |
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | |
38 | 38 | }; |
39 | 39 | |
40 | - var alert_msg = function(msg,product_id){ | |
40 | + var alert_msg = function(msg,product_id){ | |
41 | 41 | winW = document.body.offsetWidth; |
42 | 42 | winH = document.body.offsetHeight |
43 | 43 | $('.modal_box').remove(); |
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | $('#data_box').remove(); |
67 | 67 | }); |
68 | 68 | }; |
69 | - | |
69 | + | |
70 | 70 | find_products(); |
71 | 71 | start_basket(); |
72 | 72 | |
... | ... | @@ -173,11 +173,11 @@ |
173 | 173 | |
174 | 174 | } ); |
175 | 175 | } |
176 | - | |
176 | + | |
177 | 177 | }; |
178 | 178 | |
179 | 179 | Controll.init(); |
180 | 180 | // frontend calculator |
181 | - } | |
181 | + } | |
182 | 182 | |
183 | 183 | })(jQuery); |
184 | 184 | \ No newline at end of file | ... | ... |
js/new-basket.js
... | ... | @@ -4,9 +4,6 @@ $(document).ready(function() { |
4 | 4 | function modalForms() { |
5 | 5 | $('body').on('click', '.modal-link', function (e) { |
6 | 6 | e.preventDefault(); |
7 | - | |
8 | - | |
9 | - | |
10 | 7 | var idForm = $(this).data('form'); |
11 | 8 | var pos = ($(window).scrollTop()) + 30; |
12 | 9 | |
... | ... | @@ -38,6 +35,23 @@ $(document).ready(function() { |
38 | 35 | }); |
39 | 36 | } |
40 | 37 | |
38 | + $(document).on('click', '.new-btn-modal-basket', showBasket); | |
39 | + $(document).on('click', '.basket-card', showBasket); | |
40 | + | |
41 | + function showBasket(e) { | |
42 | + e.preventDefault(); | |
43 | + | |
44 | + var idForm = 'new-basket-modal'; | |
45 | + var pos = ($(window).scrollTop()) + 30; | |
46 | + | |
47 | + $('#overlay').fadeIn(400, | |
48 | + function(){ | |
49 | + $('#'+idForm).css('display', 'block').animate({opacity: 1, top: pos}, 200); | |
50 | + } | |
51 | + ); | |
52 | + } | |
53 | + | |
54 | + | |
41 | 55 | $(document).on('click', '.quantity-wr span', changeBasket); |
42 | 56 | $(document).on('keypress', '.quantity-wr input', setControl); |
43 | 57 | ... | ... |