-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
38 lines (35 loc) · 1.31 KB
/
Copy pathscript.js
File metadata and controls
38 lines (35 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var swiper = new Swiper(".mySwiper", {
slidesPerView: 3,
spaceBetween: 30,
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});
// JavaScript для плавной прокрутки к якорным ссылкам
document.querySelectorAll('a[href^="#"]').forEach((anchor) => {
anchor.addEventListener("click", function (e) {
e.preventDefault();
document.querySelector(this.getAttribute("href")).scrollIntoView({
behavior: "smooth",
});
});
});
// Добавление анимации для всех тегов <input>
document.querySelectorAll("input").forEach((input) => {
input.addEventListener("focus", function () {
this.classList.add("animate__animated", "animate__tada");
});
input.addEventListener("blur", function () {
this.classList.remove("animate__animated", "animate__tada");
});
});
// Добавление анимации для всех тегов <a>
document.querySelectorAll("a").forEach((a) => {
a.addEventListener("focus", function () {
this.classList.add("animate__animated", "animate__rubberBand");
});
a.addEventListener("blur", function () {
this.classList.remove("animate__animated", "animate__rubberBand");
});
});