-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
<link rel="preload" href="./fonts/montserrat-bold.woff2" type="font/woff2" as="font" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css"> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/nouislider.min.css"> | ||
<link rel="stylesheet" href="./css/style.css"> | ||
<title>Интернет магазин: Drink2Go</title> | ||
</head> | ||
|
@@ -191,21 +192,10 @@ <h2 class="catalog__title title">Каталог кофейных напитко | |
<form class="catalog__form form" method="get" action="https://echo.htmlacademy.ru/"> | ||
<fieldset class="form__group"> | ||
<legend class="form__heading">Цена</legend> | ||
<div class="form__range range"> | ||
<div class="range__scale"> | ||
<div class="range__bar" style="left: 0%; width: 93%"> | ||
<button class="range__toggle range__toggle--min" type="button"> | ||
<span class="visually-hidden">Изменить минимальную цену.</span> | ||
</button> | ||
<button class="range__toggle range__toggle--max" type="button"> | ||
<span class="visually-hidden">Изменить максимальную цену.</span> | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="form__range range-slider"></div> | ||
<div class="form__number number"> | ||
<label class="visually-hidden" for="min-price">Минимальная цена.</label> | ||
<input class="number__input" type="number" name="min-price" id="min-price" placeholder="0"> | ||
<input class="number__input" type="number" value="0" name="min-price" id="min-price" placeholder="0"> | ||
<label class="visually-hidden" for="max-price">Максимальная цена.</label> | ||
<input class="number__input" type="number" value="900" name="max-price" id="max-price" placeholder="1000"> | ||
</div> | ||
|
@@ -547,6 +537,7 @@ <h2 class="visually-hidden">Авторское право.</h2> | |
</footer> | ||
<script src="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.js" defer></script> | ||
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" defer></script> | ||
<script src="https://unpkg.com/[email protected]/dist/nouislider.min.js"></script> | ||
<script src="./js/main.js" type="module"></script> | ||
</body> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import "./mobile-menu.js"; | ||
import "./swiper.js"; | ||
import "./range-slider.js"; | ||
import "./map.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const slider = document.querySelector('.range-slider'); | ||
const numberInputs = document.querySelectorAll('.number__input'); | ||
const buttonReset = document.querySelector('.button--reset'); | ||
|
||
noUiSlider.create(slider, { | ||
start: [0, 900], | ||
connect: true, | ||
margin: 1, | ||
step: 1, | ||
range: { | ||
'min': 0, | ||
'max': 1000 | ||
} | ||
}); | ||
|
||
slider.noUiSlider.on('update', (values, handle) => { | ||
numberInputs[handle].value = Math.round(values[handle]); | ||
}); | ||
|
||
const setRangeSlider = (index, value) => { | ||
const values = [null, null]; | ||
values[index] = value; | ||
slider.noUiSlider.set(values); | ||
}; | ||
|
||
numberInputs.forEach((input, index) => { | ||
input.addEventListener('change', (evt) => { | ||
setRangeSlider(index, evt.target.value); | ||
}); | ||
}); | ||
|
||
buttonReset.addEventListener('click', () => { | ||
slider.noUiSlider.reset(); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters