Spaces:
Running

storeogencro / script.js
donceops's picture
du må slette det det står om oss du skal få vite alt i album og musikkvideo på YouTube som kommer til å komme ut litt for lite men det liker ikke hvordan nettsiden er laget men den ser veldig Basic ut jeg vil skaffe som den var inne på et eksklusivt luxury store, jeg hadde tenkt å integrere deg shoppify til slutt
23b7352 verified
Raw History Blame
7.85 kB
// Loading screen with animated entrance
document.body.insertAdjacentHTML('afterbegin', '<loading-screen></loading-screen>');
// Add VIP badges to all product cards
document.querySelectorAll('.bg-gray-800').forEach(card => {
card.insertAdjacentHTML('afterbegin', '<vip-badge></vip-badge>');
});
// Luxury animations
const animateOnScroll = () => {
const elements = document.querySelectorAll('.animate-scroll');
elements.forEach(el => {
const rect = el.getBoundingClientRect();
if (rect.top < window.innerHeight * 0.8) {
el.classList.add('animate-fadeInUp');
}
});
};
// Shared JavaScript across all pages
document.addEventListener('DOMContentLoaded', function() {
// Initialize floating elements
gsap.to(".floating-element", {
y: 20,
duration: 3,
repeat: -1,
yoyo: true,
ease: "sine.inOut"
});
// Parallax effect for hero section
gsap.to("#hero-content", {
y: -50,
scrollTrigger: {
trigger: "#hero",
start: "top top",
end: "bottom top",
scrub: true
}
});
// Initialize scroll animations
window.addEventListener('scroll', animateOnScroll);
animateOnScroll();
// Initialize Vanta.js background
if (document.getElementById('vanta-bg')) {
VANTA.GLOBE({
el: "#vanta-bg",
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 200.00,
minWidth: 200.00,
scale: 1.00,
scaleMobile: 1.00,
color: 0xd946ef,
color2: 0x8b5cf6,
backgroundColor: 0x111827,
size: 1.00,
lineHeight: 18.00,
spacing: 17.00,
speed: 0.50
});
}
// Add to cart functionality
const addToCartButtons = document.querySelectorAll('button:contains("ADD TO CART")');
addToCartButtons.forEach(button => {
button.addEventListener('click', function() {
const productCard = this.closest('.bg-gray-800');
const productName = productCard.querySelector('h3').textContent;
// Luxury feedback
const originalText = this.textContent;
this.textContent = 'MEDLEMSKAP AKTIVERT!';
this.classList.add('bg-amber-600', 'text-gray-900');
// Show VIP modal after adding to cart
setTimeout(() => {
showVIPModal();
}, 1000);
// Confetti effect
confetti({
particleCount: 100,
spread: 70,
origin: { y: 0.6 },
colors: ['#f59e0b', '#fbbf24', '#ffffff']
});
setTimeout(() => {
this.textContent = originalText;
this.classList.remove('bg-green-600');
}, 1500);
console.log(`Added ${productName} to cart`);
});
});
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
window.scrollTo({
top: target.offsetTop - 80,
behavior: 'smooth'
});
}
});
});
// Newsletter form submission
const newsletterForm = document.querySelector('input[type="email"]').closest('div').parentElement;
if (newsletterForm) {
const submitButton = newsletterForm.querySelector('button');
submitButton.addEventListener('click', function() {
const emailInput = newsletterForm.querySelector('input[type="email"]');
const email = emailInput.value.trim();
if (email && validateEmail(email)) {
// Luxury feedback
const originalText = this.textContent;
this.textContent = 'TUSEN TAKK!';
this.classList.add('bg-amber-600');
// Golden particles animation
const particles = [];
for (let i = 0; i < 30; i++) {
particles.push({
x: newsletterForm.getBoundingClientRect().left + Math.random() * newsletterForm.offsetWidth,
y: newsletterForm.getBoundingClientRect().top + Math.random() * newsletterForm.offsetHeight,
size: Math.random() * 3 + 2,
speed: Math.random() * 2 + 1
});
}
particles.forEach(p => {
const particle = document.createElement('div');
particle.style.position = 'absolute';
particle.style.width = `${p.size}px`;
particle.style.height = `${p.size}px`;
particle.style.backgroundColor = '#fbbf24';
particle.style.borderRadius = '50%';
particle.style.left = `${p.x}px`;
particle.style.top = `${p.y}px`;
document.body.appendChild(particle);
gsap.to(particle, {
y: `-=${p.speed * 50}`,
x: `+=${(Math.random() - 0.5) * 50}`,
opacity: 0,
duration: 1.5,
ease: "power1.out",
onComplete: () => particle.remove()
});
});
emailInput.value = '';
setTimeout(() => {
this.textContent = originalText;
this.classList.remove('bg-green-600');
}, 2000);
console.log(`Subscribed with email: ${email}`);
} else {
emailInput.classList.add('border-red-500');
setTimeout(() => {
emailInput.classList.remove('border-red-500');
}, 2000);
}
});
}
// VIP Membership modal
function showVIPModal() {
const modal = document.createElement('div');
modal.className = 'fixed inset-0 bg-black bg-opacity-80 z-50 flex items-center justify-center p-4';
modal.innerHTML = `
<div class="bg-gray-900 border border-amber-500 rounded-xl max-w-md w-full p-8 relative animate-scaleIn">
<button class="absolute top-4 right-4 text-amber-500 hover:text-amber-300">
<i data-feather="x"></i>
</button>
<h3 class="text-2xl font-bold text-amber-500 mb-4">Bli En Del Av Familien</h3>
<p class="text-gray-300 mb-6">
Ved å kjøpe denne eksklusive kolleksjonen blir du en del av OG ENCRO-familien.
Få tilgang til tidlig utgivelse av albumet, VIP-arrangementer og muligheten til
å tjene penger på begrensede utgaver.
</p>
<div class="flex justify-end">
<button class="px-6 py-3 bg-amber-600 hover:bg-amber-700 rounded-lg font-bold transition-colors">
Jeg Er Med
</button>
</div>
</div>
`;
document.body.appendChild(modal);
feather.replace();
modal.querySelector('button').addEventListener('click', () => {
gsap.to(modal.querySelector('div'), {
scale: 0.9,
opacity: 0,
duration: 0.3,
ease: "power1.in",
onComplete: () => modal.remove()
});
});
}
// Email validation helper
function validateEmail(email) {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
}
// Navbar scroll effect
window.addEventListener('scroll', function() {
const navbar = document.querySelector('custom-navbar');
if (window.scrollY > 50) {
navbar.classList.add('scrolled');
} else {
navbar.classList.remove('scrolled');
}
});
});