Update 1.js
This commit is contained in:
+6
-5
@@ -3,18 +3,18 @@ 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; // Tetik noktası: ekranın alt %80'i
|
||||||
|
|
||||||
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 > 0) {
|
if (boxTop < triggerBottom && boxBottom > triggerBottom / 2) {
|
||||||
// Kutucuk ekranın içinde 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 {
|
} else if (boxBottom <= triggerBottom / 2) {
|
||||||
// Kutucuk ekran dışında ise gizle
|
// Kutucuk ekranın üst kısmına çıktığında gizle
|
||||||
box.classList.remove('visible');
|
box.classList.remove('visible');
|
||||||
box.classList.add('hidden');
|
box.classList.add('hidden');
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,7 @@ 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');
|
||||||
|
|||||||
Reference in New Issue
Block a user