Initial AI-generated site
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// Mobile menu toggle
|
||||
const mobileMenuBtn = document.querySelector('.mobile-menu-btn');
|
||||
const mobileNav = document.getElementById('mobileNav');
|
||||
|
||||
if (mobileMenuBtn && mobileNav) {
|
||||
mobileMenuBtn.addEventListener('click', function() {
|
||||
mobileNav.classList.toggle('active');
|
||||
const isOpen = mobileNav.classList.contains('active');
|
||||
mobileMenuBtn.setAttribute('aria-expanded', isOpen);
|
||||
});
|
||||
|
||||
// Close menu when clicking a link
|
||||
mobileNav.querySelectorAll('a').forEach(function(link) {
|
||||
link.addEventListener('click', function() {
|
||||
mobileNav.classList.remove('active');
|
||||
mobileMenuBtn.setAttribute('aria-expanded', 'false');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Scroll reveal animation
|
||||
function initScrollReveal() {
|
||||
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||
// If user prefers reduced motion, make all elements visible immediately
|
||||
document.querySelectorAll('.situation-card, .guide-link, .learn-card, .uni-logo-item').forEach(function(el) {
|
||||
el.classList.add('visible');
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const observerOptions = {
|
||||
root: null,
|
||||
rootMargin: '0px 0px -50px 0px',
|
||||
threshold: 0.1
|
||||
};
|
||||
|
||||
const observer = new IntersectionObserver(function(entries) {
|
||||
entries.forEach(function(entry, index) {
|
||||
if (entry.isIntersecting) {
|
||||
// Stagger the animation
|
||||
setTimeout(function() {
|
||||
entry.target.classList.add('visible');
|
||||
}, index * 50);
|
||||
observer.unobserve(entry.target);
|
||||
}
|
||||
});
|
||||
}, observerOptions);
|
||||
|
||||
document.querySelectorAll('.situation-card, .guide-link, .learn-card, .uni-logo-item').forEach(function(el) {
|
||||
observer.observe(el);
|
||||
});
|
||||
}
|
||||
|
||||
// Header scroll effect
|
||||
function initHeaderScroll() {
|
||||
const header = document.querySelector('.header');
|
||||
let lastScroll = 0;
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
const currentScroll = window.pageYOffset;
|
||||
|
||||
if (currentScroll > 100) {
|
||||
header.style.boxShadow = '0 2px 10px rgba(0,0,0,0.1)';
|
||||
} else {
|
||||
header.style.boxShadow = 'none';
|
||||
}
|
||||
|
||||
lastScroll = currentScroll;
|
||||
}, { passive: true });
|
||||
}
|
||||
|
||||
// Smooth scroll for anchor links
|
||||
function initSmoothScroll() {
|
||||
document.querySelectorAll('a[href^="#"]').forEach(function(anchor) {
|
||||
anchor.addEventListener('click', function(e) {
|
||||
const targetId = this.getAttribute('href');
|
||||
if (targetId === '#') return;
|
||||
|
||||
const targetElement = document.querySelector(targetId);
|
||||
if (targetElement) {
|
||||
e.preventDefault();
|
||||
const headerHeight = document.querySelector('.header').offsetHeight;
|
||||
const targetPosition = targetElement.getBoundingClientRect().top + window.pageYOffset - headerHeight - 20;
|
||||
|
||||
window.scrollTo({
|
||||
top: targetPosition,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Form handling
|
||||
function initForm() {
|
||||
const form = document.querySelector('.contact-form form');
|
||||
if (form) {
|
||||
form.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const nameInput = form.querySelector('input[type="text"]');
|
||||
const phoneInput = form.querySelector('input[type="tel"]');
|
||||
const submitBtn = form.querySelector('button[type="submit"]');
|
||||
|
||||
if (nameInput.value.trim() && phoneInput.value.trim()) {
|
||||
submitBtn.textContent = 'תודה! ניצור קשר בקרוב';
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.style.background = 'var(--ez-green)';
|
||||
|
||||
// Reset after 3 seconds
|
||||
setTimeout(function() {
|
||||
submitBtn.textContent = 'שלחו לי פרטים';
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.style.background = '';
|
||||
form.reset();
|
||||
}, 3000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// University logo hover effect
|
||||
function initLogoHover() {
|
||||
document.querySelectorAll('.uni-logo-item').forEach(function(logo) {
|
||||
logo.addEventListener('click', function() {
|
||||
// Placeholder for modal or link functionality
|
||||
console.log('Logo clicked:', this.getAttribute('title'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize all functions when DOM is ready
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
initScrollReveal();
|
||||
initHeaderScroll();
|
||||
initSmoothScroll();
|
||||
initForm();
|
||||
initLogoHover();
|
||||
});
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user