Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Set creation functionality
+ const setInput = document.getElementById('setInput');
+ const createSetBtn = document.getElementById('createSet');
+ const setDisplay = document.getElementById('setDisplay');
+
+ createSetBtn.addEventListener('click', () => {
+ const elements = setInput.value.split(',').map(e => e.trim());
+ const uniqueElements = [...new Set(elements)];
+
+ if (elements.length > 0 && elements[0] !== '') {
+ const setElement = document.createElement('div');
+ setElement.classList.add('card');
+ setElement.innerHTML = `
+
Created Set
+
{${uniqueElements.join(', ')}}
+ `;
+ setDisplay.prepend(setElement);
+ }
+
+ setInput.value = '';
+ });
+
+ // Smooth scrolling for navigation
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
+ behavior: 'smooth'
+ });
+ });
+ });
+
+ // Animation for cards on scroll
+ const observerOptions = {
+ threshold: 0.1
+ };
+
+ const observer = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ if (entry.isIntersecting) {
+ entry.target.style.opacity = '1';
+ entry.target.style.transform = 'translateY(0)';
+ }
+ });
+ }, observerOptions);
+
+ document.querySelectorAll('.card').forEach(card => {
+ card.style.opacity = '0';
+ card.style.transform = 'translateY(20px)';
+ card.style.transition = 'all 0.5s ease-out';
+ observer.observe(card);
+ });
+ });