-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
89 lines (70 loc) · 2.56 KB
/
Copy pathscript.js
File metadata and controls
89 lines (70 loc) · 2.56 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
document.addEventListener("DOMContentLoaded", () => {
// =========================
// ПЕЧАТАЮЩИЙСЯ ТЕКСТ
// =========================
const text = "Тамила Аскаровна";
let i = 0;
const typingEl = document.getElementById("typing");
function typeEffect() {
if (!typingEl) return;
if (i < text.length) {
typingEl.innerHTML += text.charAt(i);
i++;
setTimeout(typeEffect, 300); // Скорость печати (300ms)
}
}
typeEffect();
// =========================
// АНИМАЦИЯ СЕКЦИЙ
// =========================
const sections = document.querySelectorAll("section");
const observer = new IntersectionObserver(
entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = "1";
entry.target.style.transform = "translateY(0)";
}
});
},
{ threshold: 0.2 }
);
sections.forEach(section => observer.observe(section));
// =========================
// МАГНИТНЫЕ КАРТОЧКИ
// =========================
const cards = document.querySelectorAll(".project-card");
cards.forEach(card => {
card.addEventListener("mousemove", e => {
const rect = card.getBoundingClientRect();
const x = e.clientX - rect.left - rect.width / 2;
const y = e.clientY - rect.top - rect.height / 2;
card.style.transform = `translate(${x * 0.05}px, ${y * 0.05}px) scale(1.03)`;
});
card.addEventListener("mouseleave", () => {
card.style.transform = "translate(0,0) scale(1)";
});
});
// =========================
// КНОПКА СВЯЗИ (без ошибок)
// =========================
const contactBtn = document.getElementById("contactBtn");
if (contactBtn) {
contactBtn.addEventListener("click", () => {
alert("Связаться со мной: youdo5725@gmail.com или Telegram @Tamila5725");
});
}
// =========================
// ЧАСТИЦЫ (если подключены)
// =========================
if (window.tsParticles) {
tsParticles.load("tsparticles", {
particles: {
number: { value: 50 },
color: { value: "#06b6d4" },
size: { value: 2 },
move: { enable: true, speed: 1 }
}
});
}
});