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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Slider Demo</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<wc-slider min="50" max="200" step="0" value="100"></wc-slider> |
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
export const showPassword = (btn) => { | |
const input = btn.parentElement.querySelector('input'); | |
if (btn.classList.contains('show')) { | |
btn.classList.remove('show'); | |
input.type = 'password'; | |
} else { | |
btn.classList.add('show'); | |
input.type = 'text'; |
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
<fieldset class="rating"> | |
<legend class="visually-hidden">Звездный рейтинг</legend> | |
<input id="film-1" type="radio" name="film" value="1"> | |
<input id="film-2" type="radio" name="film" value="2"> | |
<input id="film-3" type="radio" name="film" value="3"> | |
<input id="film-4" type="radio" name="film" value="4" checked> | |
<input id="film-5" type="radio" name="film" value="5"> | |
<label for="film-5" aria-label="5 звезд"> | |
<svg width="44" height="43"> |
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
import {onFocusPhoneInput} from './onFocusPhoneInput'; | |
const validationData = {}; | |
const urlData = 'data/sendForm.json'; | |
fetch(urlData).then((res) => res.json()).then((res) => { | |
Object.assign(validationData, res); | |
}).catch(() => {}); | |
/*const getDataFromJson = function(url) { | |
const xhr = new XMLHttpRequest(); |
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
<div class="custom-select active"> | |
<div class="custom-select__title">Санкт-Петербург</div> | |
<div class="custom-select__content"> | |
<input id="singleSelect0" type="radio" name="city" value="spb" checked /> | |
<label for="singleSelect0" class="custom-select__label">Санкт-Петербург</label> | |
<input id="singleSelect1" type="radio" name="city" value="moscow" /> | |
<label for="singleSelect1" class="custom-select__label">Москва</label> | |
<input id="singleSelect2" type="radio" name="city" value="vasuki" /> | |
<label for="singleSelect2" class="custom-select__label">Новые Васюки</label> | |
<input id="singleSelect3" type="radio" name="city" value="samara" /> |
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
// const targetDate = new Date(Date.parse('2021-05-17T00:00:00')); // установить дату обратного отсчета | |
const targetDate = new Date(2021, 4, 16); // установить дату обратного отсчета | |
let days; let hours; let minutes; let seconds; // переменные для единиц времени | |
let interval = null; | |
const countdown = document.querySelector('.stock-timer-js'); // получить элемент тега | |
const addZero = (n) => { | |
return (n < 10 ? '0' : '') + n; | |
}; |
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
export default class Dbrange { | |
constructor(selector) { | |
this.$el = this.getHtmlElement(selector); | |
if (!this.$el) return; | |
this.dom = this.mapDOM(this.$el); | |
this.eventNames = { | |
pointerdown: 'pointerdown', | |
pointermove: 'pointermove', | |
pointerup: 'pointerup', | |
}; |
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
async function supportsImgType(type) { | |
const img = document.createElement('img'); | |
await document.createElement('picture').append( | |
Object.assign(document.createElement('source'), { | |
srcset: 'data:,x', // валидный урл не дергающий сеть | |
type, | |
}), | |
img | |
); | |
return !!img.currentSrc; // если браузер умеет, заполнит значение currentSrc |
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
const container = document.querySelector('.accordion-container'); | |
const titles = document.querySelectorAll('.accordion-title'); | |
titles.forEach(t => { | |
t.addEventListener('click', ({currentTarget}) => { | |
const contentHeight = currentTarget.nextElementSibling.offsetHeight; | |
container.style.setProperty('--content-height', `${-contentHeight}px`); | |
const accordion = currentTarget.parentElement; | |
if (accordion.classList.contains('accordion-active')) { | |
accordion.classList.remove('accordion-active', 'move-sibling-accordion'); | |
return |
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
export default class Range { | |
constructor(selector) { | |
this.$el = this.getHtmlElement(selector); | |
if (!this.$el) return; | |
this.min = +this.$el.dataset.min ?? 0; | |
this.max = +this.$el.dataset.max ?? 100; | |
this.dom = this.mapDOM(this.$el); | |
this.eventNames = { | |
pointerdown: 'pointerdown', | |
pointermove: 'pointermove', |