Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Neem-Sheth authored Jan 12, 2024
1 parent 82b44ef commit faed21c
Showing 1 changed file with 69 additions and 60 deletions.
129 changes: 69 additions & 60 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,89 +1,98 @@
// document.addEventListener("DOMContentLoaded", function () {
// const startTime = performance.now();

// window.addEventListener("load", function () {
// const endTime = performance.now();
// const loadingTime = endTime - startTime;

// const minimumDuration = 2000;

// const animationDuration = Math.max(minimumDuration, loadingTime);

// setTimeout(function () {
// document.getElementById("preloader-container").classList.add("hidden");
// document.getElementById("content").classList.remove("hidden");
// }, animationDuration);
// });
// });

document.addEventListener("DOMContentLoaded", function () {
const startTime = performance.now();

window.addEventListener("load", function () {

const animationDuration = 5000;

setTimeout(function () {
document.getElementById("preloader-container").classList.add("hidden");
document.getElementById("content").classList.remove("hidden");
}, animationDuration);
});
});
// document.addEventListener("DOMContentLoaded", function () {
// const startTime = performance.now();

// window.addEventListener("load", function () {

// const animationDuration = 5000;

// setTimeout(function () {
// document.getElementById("preloader-container").classList.add("hidden");
// document.getElementById("content").classList.remove("hidden");
// }, animationDuration);
// });
// });

// document.addEventListener("DOMContentLoaded", function () {
// setTimeout(function () {
// document.getElementById("preloader-container").classList.add("hidden");
// document.getElementById("content").classList.remove("hidden");
// }, 5000);
// });

setTimeout(function () {
document.getElementById("preloader-container").classList.add("hidden");
document.getElementById("content").classList.remove("hidden");
}, 5000);

const observer = new IntersectionObserver((entries) => {
entries.forEach((entry) =>{
console.log(entry)
if(entry.isIntersecting){
entry.target.classList.add('show');
}
else{
entry.target.classList.remove('show');
}
})
})

const hiddenElements = document.querySelectorAll('.hiddenn');
entries.forEach((entry) => {
console.log(entry);
if (entry.isIntersecting) {
entry.target.classList.add("show");
} else {
entry.target.classList.remove("show");
}
});
});

const hiddenElements = document.querySelectorAll(".hiddenn");
hiddenElements.forEach((el) => observer.observe(el));

//gallery =>

const obs = new IntersectionObserver((entries) => {
entries.forEach((entry) => {
if(entry.isIntersecting){
entry.target.classList.add('someshow');
}
else{
entry.target.classList.remove('someshow');
}
})
})

const hiddenGalleryElements = document.querySelectorAll('.sometry');
entries.forEach((entry) => {
if (entry.isIntersecting) {
entry.target.classList.add("someshow");
} else {
entry.target.classList.remove("someshow");
}
});
});

const hiddenGalleryElements = document.querySelectorAll(".sometry");
hiddenGalleryElements.forEach((el) => obs.observe(el));

document.addEventListener('DOMContentLoaded', function () {
var header = document.getElementById('header');

window.onscroll = function () {
// Add or remove the "shrink" class based on scroll position
if (window.pageYOffset > 50) {
header.classList.add('shrink');
} else {
header.classList.remove('shrink');
}
};
document.addEventListener("DOMContentLoaded", function () {
var header = document.getElementById("header");

window.onscroll = function () {
// Add or remove the "shrink" class based on scroll position
if (window.pageYOffset > 50) {
header.classList.add("shrink");
} else {
header.classList.remove("shrink");
}
};
});

distance.oninput = e => {
wrap.style.setProperty('--distance', e.target.value + '%')
}
thickness.oninput = e => {
wrap.style.setProperty('--border', e.target.value + 'px')
}
distance.oninput = (e) => {
wrap.style.setProperty("--distance", e.target.value + "%");
};

thickness.oninput = (e) => {
wrap.style.setProperty("--border", e.target.value + "px");
};

function toggleNavItems() {
const navItems = document.getElementById('nav-items');
navItems.classList.toggle('nav-show');
const navItems = document.getElementById("nav-items");
navItems.classList.toggle("nav-show");
}

0 comments on commit faed21c

Please sign in to comment.