Update 1.js

This commit is contained in:
FURK4NGG
2024-11-27 00:57:31 +03:00
committed by GitHub
parent f04ef7f32d
commit 42b95176d1
+2 -5
View File
@@ -1,14 +1,13 @@
// Kutucukları seç /*SERVICES VISIBILITY*/
const boxes = document.querySelectorAll('.services_id'); const boxes = document.querySelectorAll('.services_id');
// Görünürlük kontrol fonksiyonu // Görünürlük kontrol fonksiyonu
function checkVisibility() { function checkVisibility() {
const triggerBottom = window.innerHeight * 0.8; // Ekranın %80'i tetik noktası const triggerBottom = window.innerHeight * 0.8;
boxes.forEach((box) => { boxes.forEach((box) => {
const boxTop = box.getBoundingClientRect().top; const boxTop = box.getBoundingClientRect().top;
// Eğer kutunun üst kenarı tetikleme noktasını geçerse görünür yap
if (boxTop < triggerBottom) { if (boxTop < triggerBottom) {
box.classList.add('visible'); box.classList.add('visible');
box.classList.remove('hidden'); box.classList.remove('hidden');
@@ -20,12 +19,10 @@ function checkVisibility() {
}); });
} }
// Scroll ve yükleme olaylarını dinle
window.addEventListener('scroll', checkVisibility); window.addEventListener('scroll', checkVisibility);
window.addEventListener('load', checkVisibility); window.addEventListener('load', checkVisibility);
/*IMAGE CHANGER*/ /*IMAGE CHANGER*/
let currentIndex = 0; let currentIndex = 0;
const images = document.querySelectorAll('#photo img'); const images = document.querySelectorAll('#photo img');