Commit b3c018130d16a760f357c2b65776571b08fb8e3a
1 parent
fc66ded4
Вёрстка сортировки товаров
Showing
3 changed files
with
90 additions
and
1 deletions
Show diff stats
frontend/views/category/view.php
| ... | ... | @@ -324,7 +324,20 @@ _________________________________________________________ --> |
| 324 | 324 | _________________________________________________________ --> |
| 325 | 325 | |
| 326 | 326 | <div class="col-sm-9"> |
| 327 | - | |
| 327 | + <div class="col-md-12 sort-cat-wr"> | |
| 328 | + <p>Сортировка:</p> | |
| 329 | + <div class="sort-cat"> | |
| 330 | + <a id="category-sort" href="#3"> | |
| 331 | + <span>по имени от А до Я</span> | |
| 332 | + <i class="fa fa-angle-down" aria-hidden="true"></i> | |
| 333 | + </a> | |
| 334 | + <ul class="sorter"> | |
| 335 | + <li><a href="#1">по цене по уменьшению</a></li> | |
| 336 | + <li><a href="#2">по цене по возрастанию</a></li> | |
| 337 | + <li><a href="#4">по имени от Я до А</a></li> | |
| 338 | + </ul> | |
| 339 | + </div> | |
| 340 | + </div> | |
| 328 | 341 | <?php |
| 329 | 342 | echo ListView::widget( |
| 330 | 343 | [ | ... | ... |
frontend/web/css/style.css
| ... | ... | @@ -4769,4 +4769,64 @@ a i.fa, button i.fa, span.fa { |
| 4769 | 4769 | .owl-carousel.brand-carousel .owl-item { |
| 4770 | 4770 | float: none; |
| 4771 | 4771 | display: inline-block; |
| 4772 | +} | |
| 4773 | + | |
| 4774 | +.sort-cat-wr p, .sort-cat-wr .sort-cat{ | |
| 4775 | + float: left; | |
| 4776 | +} | |
| 4777 | + | |
| 4778 | +.sort-cat-wr{ | |
| 4779 | + position: relative; | |
| 4780 | +} | |
| 4781 | + | |
| 4782 | +.sort-cat-wr{ | |
| 4783 | + z-index: 10; | |
| 4784 | + margin-bottom: 25px; | |
| 4785 | +} | |
| 4786 | +.sort-cat-wr ul.sorter{ | |
| 4787 | + width: auto; | |
| 4788 | + margin: 0; | |
| 4789 | + padding: 0; | |
| 4790 | + list-style: none; | |
| 4791 | + left: 0px; | |
| 4792 | + margin-top: 5px; | |
| 4793 | + background-color: #fff; | |
| 4794 | +} | |
| 4795 | +.sorter li { | |
| 4796 | + padding: 5px 0; | |
| 4797 | +} | |
| 4798 | + | |
| 4799 | +.sort-cat{ | |
| 4800 | + margin: 0 5px; | |
| 4801 | + position: absolute; | |
| 4802 | + left: 100px; | |
| 4803 | + padding: 17px 20px; | |
| 4804 | + top: -17px; | |
| 4805 | +} | |
| 4806 | +.sort-cat a{ | |
| 4807 | + background-color: #fff; | |
| 4808 | + color: #005bac; | |
| 4809 | +} | |
| 4810 | +.sort-cat a span{ | |
| 4811 | + font-weight: bold; | |
| 4812 | +} | |
| 4813 | +.sort-cat.active{ | |
| 4814 | + box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2); | |
| 4815 | + border-radius: 5px; | |
| 4816 | + background-color: #fff; | |
| 4817 | +} | |
| 4818 | +.sort-cat .sorter{ | |
| 4819 | + display: none; | |
| 4820 | +} | |
| 4821 | +.sort-cat.active .sorter{ | |
| 4822 | + display: block; | |
| 4823 | +} | |
| 4824 | +.sort-cat.active a#category-sort{ | |
| 4825 | + color:#000; | |
| 4826 | +} | |
| 4827 | +.sort-cat a#category-sort i.fa-angle-down{ | |
| 4828 | + transition: 0.2s; | |
| 4829 | +} | |
| 4830 | +.sort-cat.active a#category-sort i.fa-angle-down{ | |
| 4831 | + transform: rotate(180deg); | |
| 4772 | 4832 | } |
| 4773 | 4833 | \ No newline at end of file | ... | ... |
frontend/web/js/script.js
| ... | ... | @@ -248,6 +248,22 @@ $(function() { |
| 248 | 248 | ); |
| 249 | 249 | } |
| 250 | 250 | ); |
| 251 | + $(document).on('click', '#category-sort', function(e){ | |
| 252 | + $(this).parent().toggleClass("active"); | |
| 253 | + return false; | |
| 254 | + }); | |
| 255 | + $(document).on('click', '.sorter li a', function(e){ | |
| 256 | + var sortclick = $(this).text(); | |
| 257 | + parentsort = $(".sort-cat a span"); | |
| 258 | + pstext = $(parentsort).text(); | |
| 259 | + mainlink = $(".sort-cat a").attr('href'); | |
| 260 | + newmainlink = $(this).attr('href'); | |
| 261 | + $(parentsort).text(sortclick); | |
| 262 | + $(".sort-cat a#category-sort").attr('href', newmainlink); | |
| 263 | + $(this).text(pstext); | |
| 264 | + $(this).attr('href', mainlink); | |
| 265 | + $("#category-sort").click(); | |
| 266 | + }); | |
| 251 | 267 | |
| 252 | 268 | }); |
| 253 | 269 | function showLoader(container) { | ... | ... |