2022-06-12 13:51:47 -07:00
|
|
|
// Gilroy Hacks Website Source Code -> JS (https://gilroyhacks.com)
|
|
|
|
|
2022-06-11 23:03:46 -07:00
|
|
|
// Creating an observer when the user views that element
|
2022-06-03 01:42:59 -07:00
|
|
|
const observer = new IntersectionObserver(entries => {
|
|
|
|
// Loop over the entries
|
|
|
|
entries.forEach(entry => {
|
|
|
|
// If the element is visible
|
|
|
|
if (entry.isIntersecting) {
|
|
|
|
// Add the animation class
|
|
|
|
entry.target.classList.add('slide-animation');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2022-06-03 15:38:07 -07:00
|
|
|
|
|
|
|
const observer_prize_2 = new IntersectionObserver(entries => {
|
|
|
|
entries.forEach(entry => {
|
|
|
|
if (entry.isIntersecting) {
|
|
|
|
entry.target.classList.add('slide-animation-prize-2');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const observer_prize_1 = new IntersectionObserver(entries => {
|
|
|
|
entries.forEach(entry => {
|
|
|
|
if (entry.isIntersecting) {
|
|
|
|
entry.target.classList.add('slide-animation-prize-1');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2022-06-03 01:42:59 -07:00
|
|
|
|
2022-06-03 15:38:07 -07:00
|
|
|
const observer_prize_3 = new IntersectionObserver(entries => {
|
|
|
|
entries.forEach(entry => {
|
|
|
|
if (entry.isIntersecting) {
|
|
|
|
entry.target.classList.add('slide-animation-prize-3');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-06-04 19:02:18 -07:00
|
|
|
const observer_team_img = new IntersectionObserver(entries => {
|
|
|
|
entries.forEach(entry => {
|
|
|
|
if (entry.isIntersecting) {
|
|
|
|
entry.target.classList.add('slide-animation-card-img');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const observer_team_desc = new IntersectionObserver(entries => {
|
|
|
|
entries.forEach(entry => {
|
|
|
|
if (entry.isIntersecting) {
|
|
|
|
entry.target.classList.add('slide-animation-card-desc');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
const entries = document.querySelectorAll('.team-picture');
|
|
|
|
entries.forEach(entry => {
|
|
|
|
observer_team_img.observe(entry);
|
|
|
|
});
|
|
|
|
|
|
|
|
const entries_desc = document.querySelectorAll('.team-description');
|
|
|
|
entries_desc.forEach(entry => {
|
|
|
|
observer_team_desc.observe(entry);
|
|
|
|
});
|
|
|
|
|
2022-06-11 23:03:46 -07:00
|
|
|
|
|
|
|
// Adding the class animations to these elements
|
2022-06-30 23:16:51 -07:00
|
|
|
let elements_id = ['#description-heading', '#event-main-box', '#timeline', '#signup-title', '#steps-card', '#sponsor-title', '#sponsor-container', '#map-article', '#rules-description', '#guidelines', '#code-of-conduct', '#photo-release-container', '#second-column', '#first-column', '#third-column', '#prize-box', '#administration', '#logistics', '#outreach', '#tech', '#marketing'];
|
2022-06-11 23:03:46 -07:00
|
|
|
elements_id.forEach(entry => {
|
|
|
|
observer.observe(document.querySelector(entry));
|
|
|
|
});
|
|
|
|
|
2022-06-03 15:38:07 -07:00
|
|
|
observer_prize_2.observe(document.querySelector('#second-place'));
|
|
|
|
observer_prize_1.observe(document.querySelector('#first-place'));
|
2022-06-11 23:03:46 -07:00
|
|
|
observer_prize_3.observe(document.querySelector('#third-place'));
|