-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
145 lines (124 loc) · 4.41 KB
/
Copy pathapp.js
File metadata and controls
145 lines (124 loc) · 4.41 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
const headerMMenu = document.getElementById("headerMMenu");
const mobileMenu = document.querySelector(".mobileMenu");
const mobileLinks = document.querySelectorAll(".mobileItem a");
const toTopBtn = document.getElementById("toTopBtn");
// ----------
var swiper = new Swiper('.mySwiper', {
loop: true,
direction: 'horizontal',
autoplay: {
delay: 5000,
disableOnInteraction: false,
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
scrollbar: {
el: '.swiper-scrollbar',
},
});
var swiper = new Swiper('.CardSwiper', {
effect: 'cards',
grabCursor: true,
});
// ----------
// Hamburger butona tıklayınca menüyü ve ikonu aç/kapat
headerMMenu.addEventListener("click", (e) => {
e.stopPropagation();
headerMMenu.classList.toggle("hamburger");
mobileMenu.classList.toggle("activeMenu");
});
// Menü dışına tıklanınca kapat
document.addEventListener("click", (e) => {
if (
mobileMenu.classList.contains("activeMenu") &&
!mobileMenu.contains(e.target) &&
!headerMMenu.contains(e.target)
) {
mobileMenu.classList.remove("activeMenu");
headerMMenu.classList.remove("hamburger");
}
});
// Mobil menüdeki bir linke tıklandığında menüyü kapat
mobileLinks.forEach(link => {
link.addEventListener("click", () => {
mobileMenu.classList.remove("activeMenu");
headerMMenu.classList.remove("hamburger");
});
});
// ----------
//Yukarı çık butonu / Scroll olunca butonu göster/gizle
window.addEventListener("scroll", () => {
if (window.scrollY > 200) {
toTopBtn.style.display = "block";
} else {
toTopBtn.style.display = "none";
}
});
//Tıklanınca anında yukarı çık
toTopBtn.addEventListener("click", () => {
document.documentElement.scrollTop = 0;
document.body.scrollTop = 0;
});
// ----------
const digerBtn = document.getElementById("digerHizmetlerBtn");
const hizmetlerKapsayici = document.querySelector(".hizmetler-kapsayici");
digerBtn.addEventListener("click", () => {
hizmetlerKapsayici.classList.toggle("hepsini-goster");
// Buton metnini durumuna göre değiştir
if (hizmetlerKapsayici.classList.contains("hepsini-goster")) {
digerBtn.innerHTML = 'Daha Az Göster <i class="fa-solid fa-chevron-up"></i>';
} else {
digerBtn.innerHTML = 'Diğer Hizmetler <i class="fa-solid fa-chevron-down"></i>';
}
});
// ----------
// Randevu Oluşturma Butonu
//Show social networks
const showSocial = (toggleCard, socialCard) => {
const toggle = document.getElementById(toggleCard),
social = document.getElementById(socialCard)
toggle.addEventListener('click', () => {
//if the animation class exist, we add the down-animation class
if (social.classList.contains('animation')) {
social.classList.add('down-aniamtion')
//we remove the down-animation class
setTimeout(() => {
social.classList.remove('down-aniamtion')
}, 1000)
}
//We add the animation class to the div tag with the card3__social class
social.classList.toggle('animation')
})
}
showSocial('card3-toggle', 'card3__social')
// ----------
// ----------
// Yukarı kayan etiketler
document.addEventListener("DOMContentLoaded", () => {
// .reveal sınıfına sahip tüm elemanları seçiyoruz
const reveals = document.querySelectorAll(".revealKaydir");
const observerOptions = {
root: null, // Ana ekranı baz alır
rootMargin: "0px",
threshold: 0.15 // Elemanın en az %15'i ekrana girince çalışır
};
const revealOnScroll = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
// Eleman ekrana girince 'active' sınıfını ekle
entry.target.classList.add("revealKaydirActive");
// Animasyon bir kere çalıştıktan sonra takibi bırak (İsteğe bağlı)
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Her bir elemanı gözlemciye ekliyoruz
reveals.forEach(reveal => revealOnScroll.observe(reveal));
});
// ----------