fix (скрол блок, маска, тел. поиск, прин согл.)
This commit is contained in:
@@ -48,7 +48,7 @@ const projectsSwiper = new Swiper('.projects-swiper', {
|
||||
spaceBetween: 24,
|
||||
},
|
||||
996: {
|
||||
slidesPerView: 1
|
||||
slidesPerView: 10
|
||||
},
|
||||
},
|
||||
// Navigation arrows
|
||||
@@ -251,6 +251,40 @@ itemModels.forEach(item => {
|
||||
})
|
||||
// open-modal end
|
||||
|
||||
// masks
|
||||
|
||||
let phoneInputs = document.querySelectorAll('.input__field[type=phone]');
|
||||
|
||||
phoneInputs.forEach(phoneInput => {
|
||||
phoneInput.onfocus = function (event) {
|
||||
let value = phoneInput.value;
|
||||
|
||||
if (value.length == 0) {
|
||||
phoneInput.value += '+7 '
|
||||
}
|
||||
}
|
||||
|
||||
phoneInput.addEventListener('input', function(event) {
|
||||
let value = phoneInput.value,
|
||||
data = event.data,
|
||||
length = value.length;
|
||||
|
||||
if (value.charAt(0) == '+' && length == 1) return;
|
||||
|
||||
if (isNaN(data)) {
|
||||
phoneInput.value = data.slice(0, -1)
|
||||
}
|
||||
|
||||
if (typeof data != 'object') {
|
||||
if (length == 6 || length == 10) {
|
||||
phoneInput.value = value + ' ';
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
// resize
|
||||
window.addEventListener('resize', () => {
|
||||
let screenWidth = window.screen.width;
|
||||
|
||||
Reference in New Issue
Block a user