Update 1.js
This commit is contained in:
+3
-12
@@ -1,30 +1,21 @@
|
|||||||
// Kutucukları seç
|
// Sorun çözümü için görünürlük kontrolü
|
||||||
const boxes = document.querySelectorAll('.services_id');
|
|
||||||
|
|
||||||
// Görünürlük kontrol fonksiyonu
|
|
||||||
function checkVisibility() {
|
function checkVisibility() {
|
||||||
const triggerTop = window.innerHeight * 0.2; // Ekranın altına daha yakın bir tetik noktası
|
const triggerBottom = window.innerHeight * 0.8;
|
||||||
|
|
||||||
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 < window.innerHeight && boxBottom > triggerTop) {
|
if (boxTop < triggerBottom) {
|
||||||
// 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 {
|
} else {
|
||||||
// Kutucuk ekranın dışında ise gizle
|
|
||||||
box.classList.remove('visible');
|
box.classList.remove('visible');
|
||||||
box.classList.add('hidden');
|
box.classList.add('hidden');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scroll ve yükleme olaylarını dinle
|
|
||||||
window.addEventListener('scroll', checkVisibility);
|
|
||||||
window.addEventListener('load', checkVisibility);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*IMAGE CHANGER*/
|
/*IMAGE CHANGER*/
|
||||||
|
|||||||
Reference in New Issue
Block a user