Commit 5a24921e2f468429776af4403c6f56c45a05522f
1 parent
dc92126e
Бегунок цены
Showing
3 changed files
with
38 additions
and
1 deletions
Show diff stats
frontend/views/category/view.php
| @@ -185,6 +185,9 @@ _________________________________________________________ --> | @@ -185,6 +185,9 @@ _________________________________________________________ --> | ||
| 185 | <input type="text" name="price-max" id="price-max"> | 185 | <input type="text" name="price-max" id="price-max"> |
| 186 | </div> | 186 | </div> |
| 187 | </div> | 187 | </div> |
| 188 | + <div class="col-md-12 row"> | ||
| 189 | + <button class="price-apply">применить</button> | ||
| 190 | + </div> | ||
| 188 | 191 | ||
| 189 | </div> | 192 | </div> |
| 190 | </div> | 193 | </div> |
frontend/web/css/style.css
| @@ -4884,4 +4884,16 @@ a i.fa, button i.fa, span.fa { | @@ -4884,4 +4884,16 @@ a i.fa, button i.fa, span.fa { | ||
| 4884 | .irs-from, .irs-to, .irs-single {display: none;} | 4884 | .irs-from, .irs-to, .irs-single {display: none;} |
| 4885 | .lt-ie9 .irs-from, .lt-ie9 .irs-to, .lt-ie9 .irs-single {background: #999;} | 4885 | .lt-ie9 .irs-from, .lt-ie9 .irs-to, .lt-ie9 .irs-single {background: #999;} |
| 4886 | 4886 | ||
| 4887 | -/* Range Slider Styles End */ | ||
| 4888 | \ No newline at end of file | 4887 | \ No newline at end of file |
| 4888 | +/* Range Slider Styles End */ | ||
| 4889 | + | ||
| 4890 | +button.price-apply{ | ||
| 4891 | + background-color: #428bca; | ||
| 4892 | + border: none; | ||
| 4893 | + padding: 8px 20px; | ||
| 4894 | + border-radius: 5px; | ||
| 4895 | + color: #fff; | ||
| 4896 | +} | ||
| 4897 | + | ||
| 4898 | +button.price-apply:hover{ | ||
| 4899 | + background-color:#005bac; | ||
| 4900 | +} | ||
| 4889 | \ No newline at end of file | 4901 | \ No newline at end of file |
frontend/web/js/script.js
| @@ -280,6 +280,10 @@ $(document).ready(function ($) { | @@ -280,6 +280,10 @@ $(document).ready(function ($) { | ||
| 280 | }); | 280 | }); |
| 281 | 281 | ||
| 282 | $(function(){ | 282 | $(function(){ |
| 283 | + $('.price-inputs input').keypress(function(key) { | ||
| 284 | + if(key.charCode < 48 || key.charCode > 57) return false; | ||
| 285 | + }); | ||
| 286 | + | ||
| 283 | var pricemin = $(".price_slider input").data("pricemin"); | 287 | var pricemin = $(".price_slider input").data("pricemin"); |
| 284 | pricemax = $(".price_slider input").data("pricemax"); | 288 | pricemax = $(".price_slider input").data("pricemax"); |
| 285 | $(".price-inputs #price-min").val(pricemin); | 289 | $(".price-inputs #price-min").val(pricemin); |
| @@ -301,10 +305,28 @@ $(function(){ | @@ -301,10 +305,28 @@ $(function(){ | ||
| 301 | 305 | ||
| 302 | $(document).on('change','.price-inputs #price-min',function(){ | 306 | $(document).on('change','.price-inputs #price-min',function(){ |
| 303 | var newmin = $(this).val(); | 307 | var newmin = $(this).val(); |
| 308 | + currentmax = $(".price-inputs #price-max").val(); | ||
| 309 | + if(newmin > currentmax){ | ||
| 310 | + newmin = currentmax; | ||
| 311 | + $('.price-inputs #price-min').val(currentmax); | ||
| 312 | + } | ||
| 313 | + else if(newmin > pricemax){ | ||
| 314 | + newmin = pricemax; | ||
| 315 | + $('.price-inputs #price-min').val(pricemax); | ||
| 316 | + } | ||
| 304 | slider.update({from: newmin}); | 317 | slider.update({from: newmin}); |
| 305 | }); | 318 | }); |
| 306 | $(document).on('change','.price-inputs #price-max',function(){ | 319 | $(document).on('change','.price-inputs #price-max',function(){ |
| 307 | var newmax = $(this).val(); | 320 | var newmax = $(this).val(); |
| 321 | + currentmin = $(".price-inputs #price-min").val(); | ||
| 322 | + if(newmax < currentmin){ | ||
| 323 | + newmax = currentmin; | ||
| 324 | + $('.price-inputs #price-max').val(currentmin); | ||
| 325 | + } | ||
| 326 | + else if(newmax > pricemax){ | ||
| 327 | + newmax = pricemax; | ||
| 328 | + $('.price-inputs #price-max').val(pricemax); | ||
| 329 | + } | ||
| 308 | slider.update({to: newmax}); | 330 | slider.update({to: newmax}); |
| 309 | }); | 331 | }); |
| 310 | }); | 332 | }); |