Changed around line 1
+ document.addEventListener('DOMContentLoaded', function() {
+ // Mobile menu functionality
+ const menuBtn = document.querySelector('.mobile-menu-btn');
+ const navLinks = document.querySelector('.nav-links');
+
+ menuBtn.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ });
+
+ // Sample universities data
+ const universities = [
+ "Harvard University",
+ "Stanford University",
+ "MIT",
+ "University of Toronto",
+ "McGill University",
+ "University of British Columbia",
+ "Yale University",
+ "Princeton University"
+ ];
+
+ // Populate university dropdowns
+ const uni1Select = document.getElementById('uni1');
+ const uni2Select = document.getElementById('uni2');
+
+ universities.forEach(uni => {
+ uni1Select.add(new Option(uni, uni));
+ uni2Select.add(new Option(uni, uni));
+ });
+
+ // Handle university comparison
+ function compareUniversities() {
+ const uni1 = uni1Select.value;
+ const uni2 = uni2Select.value;
+ const resultsDiv = document.getElementById('comparisonResults');
+
+ if (uni1 && uni2) {
+ // In a real application, this would fetch and display actual comparison data
+ resultsDiv.innerHTML = `
+
+
Comparing ${uni1} vs ${uni2}
+
Detailed comparison data would be displayed here
+
+ `;
+ }
+ }
+
+ uni1Select.addEventListener('change', compareUniversities);
+ uni2Select.addEventListener('change', compareUniversities);
+
+ // Smooth scrolling for navigation links
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function(e) {
+ e.preventDefault();
+ const target = document.querySelector(this.getAttribute('href'));
+ if (target) {
+ target.scrollIntoView({
+ behavior: 'smooth',
+ block: 'start'
+ });
+ // Close mobile menu if open
+ navLinks.classList.remove('active');
+ }
+ });
+ });
+
+ // Animation on scroll
+ function handleScroll() {
+ const elements = document.querySelectorAll('.resource-card, .comparison-card');
+ elements.forEach(element => {
+ const position = element.getBoundingClientRect();
+ if (position.top < window.innerHeight * 0.8) {
+ element.style.opacity = '1';
+ element.style.transform = 'translateY(0)';
+ }
+ });
+ }
+
+ window.addEventListener('scroll', handleScroll);
+ handleScroll(); // Initial check
+ });