Update 1.js

This commit is contained in:
FURK4NGG
2024-11-26 23:49:09 +03:00
committed by GitHub
parent be13c36fc0
commit 59725488fe
+5 -5
View File
@@ -1,20 +1,20 @@
// Kutucukları seç // Kutucukları seç
const boxes = document.querySelectorAll('.services_id'); const boxes = document.querySelectorAll('.animated-box');
// Görünürlük kontrol fonksiyonu // Görünürlük kontrol fonksiyonu
function checkVisibility() { function checkVisibility() {
const triggerBottom = window.innerHeight * 0.8; // Tetik noktası: ekranın alt %80'i const triggerTop = window.innerHeight * 0.2; // Ekranın altına daha yakın bir tetik noktası
boxes.forEach((box) => { boxes.forEach((box) => {
const boxTop = box.getBoundingClientRect().top; const boxTop = box.getBoundingClientRect().top;
const boxBottom = box.getBoundingClientRect().bottom; const boxBottom = box.getBoundingClientRect().bottom;
if (boxTop < triggerBottom && boxBottom > triggerBottom / 2) { if (boxTop < window.innerHeight && boxBottom > triggerTop) {
// Kutucuk ekranın alt kısmında ise görünür yap // Kutucuk ekranın alt kısmında ise görünür yap
box.classList.add('visible'); box.classList.add('visible');
box.classList.remove('hidden'); box.classList.remove('hidden');
} else if (boxBottom <= triggerBottom / 2) { } else {
// Kutucuk ekranın üst kısmına çıktığında gizle // Kutucuk ekranın dışında ise gizle
box.classList.remove('visible'); box.classList.remove('visible');
box.classList.add('hidden'); box.classList.add('hidden');
} }