fix (скрол блок, маска, тел. поиск, прин согл.)

This commit is contained in:
Kirill Pet
2024-12-20 13:57:31 +03:00
parent d7f32deadf
commit 7983a28c7a
3 changed files with 48 additions and 11 deletions

View File

@@ -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;