Update 1.js

This commit is contained in:
FURK4NGG
2025-02-20 19:52:34 +03:00
committed by GitHub
parent 2dfb239463
commit 2b6eaf4cb7
+46 -40
View File
@@ -1,43 +1,49 @@
const themeMetaTag = document.querySelector('meta[name="theme-color"]'); const themeMetaTag = document.querySelector('meta[name="theme-color"]');
function updateThemeColor() { function updateThemeColor() {
if (document.body.classList.contains("darkmode--activated")) { if (document.body.classList.contains("darkmode--activated")) {
themeMetaTag.setAttribute("content", "#fff"); // Karanlık Mod Rengi themeMetaTag.setAttribute("content", "#100f2c"); // Karanlık Mod Rengi
} else { } else {
themeMetaTag.setAttribute("content", "#fff"); // Açık Mod Rengi themeMetaTag.setAttribute("content", "#ffffff"); // Açık Mod Rengi
} }
} }
// Dark mode butonu oluştur ve çalıştır
// Dark mode değiştiğinde theme color'ı güncelle const darkmode = new Darkmode(options);
document.addEventListener("DOMContentLoaded", updateThemeColor); darkmode.showWidget();
document.addEventListener("click", updateThemeColor);
// Dark mode değiştiğinde theme color'ı güncelle
/*SERVICES VISIBILITY*/ document.addEventListener("DOMContentLoaded", updateThemeColor);
const boxes = document.querySelectorAll('.services_id'); document.addEventListener("click", () => {
setTimeout(updateThemeColor, 100); // Dark mode animasyonu için küçük gecikme
// Görünürlük kontrol fonksiyonu });
function checkVisibility() {
const triggerBottom = window.innerHeight * 0.8;
/*SERVICES VISIBILITY*/
boxes.forEach((box) => { const boxes = document.querySelectorAll('.services_id');
const boxTop = box.getBoundingClientRect().top;
// Görünürlük kontrol fonksiyonu
if (boxTop < triggerBottom) { function checkVisibility() {
box.classList.add('visible'); const triggerBottom = window.innerHeight * 0.8;
box.classList.remove('hidden');
} else { boxes.forEach((box) => {
// Aksi halde kutuyu gizle const boxTop = box.getBoundingClientRect().top;
box.classList.remove('visible');
box.classList.add('hidden'); if (boxTop < triggerBottom) {
} box.classList.add('visible');
}); box.classList.remove('hidden');
} } else {
// Aksi halde kutuyu gizle
window.addEventListener('scroll', checkVisibility); box.classList.remove('visible');
window.addEventListener('load', checkVisibility); box.classList.add('hidden');
}
});
}
window.addEventListener('scroll', 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');