Update 1.js

This commit is contained in:
FURK4NGG
2024-11-26 23:19:47 +03:00
committed by GitHub
parent b3632ef7cf
commit 958e42a6d5
+9 -6
View File
@@ -1,30 +1,33 @@
// Kutucukları seç
const boxes = document.querySelectorAll('.services_id');
let lastScrollY = 0; // Son kaydırma pozisyonunu tutar
// Görünürlük kontrol fonksiyonu
function checkVisibility() {
const triggerBottom = window.innerHeight * 0.8; // Ekranın %80'i tetik noktası
const triggerBottom = window.innerHeight * 0.8; // Tetikleme noktası
boxes.forEach((box) => {
const boxTop = box.getBoundingClientRect().top;
const boxBottom = box.getBoundingClientRect().bottom;
if (boxTop < triggerBottom && boxBottom > 0) {
// Kutucuk ekranın içinde ise görünür yap
if (boxTop < triggerBottom && boxBottom > 0 && window.scrollY > lastScrollY) {
// Sadece aşağıya kayarken kutucuk ekranın içinde ise animasyonu tetikle
box.classList.add('visible');
box.classList.remove('hidden');
} else {
// Kutucuk ekran dışında ise gizle
} else if (window.scrollY < lastScrollY && boxBottom < window.innerHeight) {
// Yukarıya kayarken kutucuk ekranın dışında ise eski durumuna dön
box.classList.remove('visible');
box.classList.add('hidden');
}
});
lastScrollY = window.scrollY; // Son kaydırma pozisyonunu güncelle
}
// Scroll ve yükleme olaylarını dinle
window.addEventListener('scroll', checkVisibility);
window.addEventListener('load', checkVisibility);
/*IMAGE CHANGER*/
let currentIndex = 0;
const images = document.querySelectorAll('#photo img');