Update 1.js

This commit is contained in:
FURK4NGG
2025-02-20 18:01:08 +03:00
committed by GitHub
parent a549d3f43b
commit 4b2282cc68
+22 -31
View File
@@ -1,36 +1,27 @@
function setThemeColor() { function updateThemeColor() {
const metaThemeColor = document.querySelector('meta[name="theme-color"]'); let themeColorMeta = document.querySelector('meta[name="theme-color"]');
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches; if (!themeColorMeta) {
metaThemeColor.setAttribute('content', isDarkMode ? '#100f2c' : '#100f2c'); themeColorMeta = document.createElement('meta');
} themeColorMeta.setAttribute('name', 'theme-color');
document.head.appendChild(themeColorMeta);
}
if (document.body.classList.contains("darkmode--activated")) {
themeColorMeta.setAttribute("content", "#100f2c"); // Karanlık mod rengi
} else {
themeColorMeta.setAttribute("content", "#F8F6E3"); // Açık mod rengi
}
}
setThemeColor(); // Sayfa yüklendiğinde kontrol et
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', setThemeColor); updateThemeColor();
/*SERVICES VISIBILITY*/ // Karanlık mod açıldığında veya kapandığında güncelle
const boxes = document.querySelectorAll('.services_id'); document.addEventListener("click", function(event) {
if (event.target.classList.contains("darkmode-toggle")) {
// Görünürlük kontrol fonksiyonu setTimeout(updateThemeColor, 300); // Animasyon süresi kadar gecikmeli çalıştır
function checkVisibility() { }
const triggerBottom = window.innerHeight * 0.8; });
boxes.forEach((box) => {
const boxTop = box.getBoundingClientRect().top;
if (boxTop < triggerBottom) {
box.classList.add('visible');
box.classList.remove('hidden');
} else {
// Aksi halde kutuyu gizle
box.classList.remove('visible');
box.classList.add('hidden');
}
});
}
window.addEventListener('scroll', checkVisibility);
window.addEventListener('load', checkVisibility);
/*IMAGE CHANGER*/ /*IMAGE CHANGER*/
let currentIndex = 0; let currentIndex = 0;