File size: 3,419 Bytes
9447a32 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | // Add smooth scrolling or any interactivity here
console.log("Website loaded successfully!");
document.addEventListener("DOMContentLoaded", function() {
const links = document.querySelectorAll('a[href^="#"]');
for (const link of links) {
link.addEventListener("click", function(e) {
e.preventDefault();
const targetId = this.getAttribute("href").substring(1);
const targetElement = document.getElementById(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: "smooth"
});
}
});
}
});
// Card hover animation (pulse effect)
document.querySelectorAll('.info-card, .quiz-card').forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'scale(1.04) rotate(-1deg)';
this.style.boxShadow = '0 8px 32px rgba(191, 161, 74, 0.18)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = '';
this.style.boxShadow = '';
});
});
// Fade-in animation for sections
document.querySelectorAll('section, .dashboard-card-row').forEach(section => {
section.style.opacity = 0;
section.style.transition = 'opacity 1.2s';
});
window.addEventListener('DOMContentLoaded', () => {
setTimeout(() => {
document.querySelectorAll('section, .dashboard-card-row').forEach(section => {
section.style.opacity = 1;
});
}, 200);
});
// Animate nav links underline on hover
document.querySelectorAll('.dashboard-menu li a').forEach(link => {
link.addEventListener('mouseenter', function() {
this.style.textDecoration = 'underline wavy #bfa14a';
this.style.textUnderlineOffset = '6px';
});
link.addEventListener('mouseleave', function() {
this.style.textDecoration = '';
this.style.textUnderlineOffset = '';
});
});
// Animate gallery images on click
const galleryImgs = document.querySelectorAll('.gallery img');
galleryImgs.forEach(img => {
img.addEventListener('click', function() {
this.style.transition = 'transform 0.4s cubic-bezier(.68,-0.55,.27,1.55)';
this.style.transform = 'scale(1.18) rotate(-2deg)';
setTimeout(() => {
this.style.transform = '';
}, 500);
});
});
// Admission form submission to Google Sheets
if (document.getElementById('admissionForm')) {
document.getElementById('admissionForm').addEventListener('submit', function(e) {
e.preventDefault();
var form = e.target;
var formData = new FormData(form);
var statusDiv = document.getElementById('formStatus');
statusDiv.textContent = 'Submitting...';
// TODO: Replace with your actual Google Apps Script Web App URL
var scriptURL = 'https://script.google.com/macros/s/AKfycbzR77b0r81Vyi_Otci8KqUPnQD_CPZPWTaFP_uEIEHq76x1sbfwxViru1g9tggWy9lQ/exec';
fetch(scriptURL, {
method: 'POST',
body: formData
})
.then(response => {
if (response.ok) {
statusDiv.style.color = '#2e7d32';
statusDiv.textContent = 'Application submitted successfully!';
form.reset();
} else {
throw new Error('Network response was not ok');
}
})
.catch(error => {
statusDiv.style.color = 'red';
statusDiv.textContent = 'Submission failed. Please try again later.';
});
});
} |