80 lines
2.4 KiB
JavaScript
80 lines
2.4 KiB
JavaScript
/* ===== BURGER MENU ===== */
|
|
function toggleMobile() {
|
|
const burger = document.getElementById('burger');
|
|
const nav = document.getElementById('mobileNav');
|
|
const isOpen = burger.classList.toggle('open');
|
|
nav.classList.toggle('open', isOpen);
|
|
document.body.style.overflow = isOpen ? 'hidden' : '';
|
|
}
|
|
|
|
function closeMobile() {
|
|
const burger = document.getElementById('burger');
|
|
const nav = document.getElementById('mobileNav');
|
|
if (burger) burger.classList.remove('open');
|
|
if (nav) nav.classList.remove('open');
|
|
document.body.style.overflow = '';
|
|
}
|
|
|
|
/* ===== SCROLL REVEAL ===== */
|
|
const revealObserver = new IntersectionObserver((entries) => {
|
|
entries.forEach(entry => {
|
|
if (entry.isIntersecting) {
|
|
entry.target.classList.add('visible');
|
|
revealObserver.unobserve(entry.target);
|
|
}
|
|
});
|
|
}, { threshold: 0.08 });
|
|
|
|
document.querySelectorAll('.reveal').forEach(el => revealObserver.observe(el));
|
|
|
|
/* ===== BILLING TOGGLE ===== */
|
|
const prices = {
|
|
month: { standard: 109.22, pro: 194.41, premium: 291.62 },
|
|
'3month': { standard: 98.30, pro: 174.97, premium: 262.46 },
|
|
year: { standard: 87.38, pro: 155.53, premium: 233.30 }
|
|
};
|
|
|
|
function setBilling(period, btn) {
|
|
document.querySelectorAll('.billing-btn').forEach(b => b.classList.remove('active'));
|
|
btn.classList.add('active');
|
|
|
|
const p = prices[period];
|
|
const els = {
|
|
'price-from': p.standard,
|
|
'price-standard': p.standard,
|
|
'price-pro': p.pro,
|
|
'price-premium': p.premium
|
|
};
|
|
|
|
Object.entries(els).forEach(([id, val]) => {
|
|
const el = document.getElementById(id);
|
|
if (el) {
|
|
el.classList.add('updating');
|
|
setTimeout(() => {
|
|
el.textContent = val.toFixed(2);
|
|
el.classList.remove('updating');
|
|
}, 150);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* ===== FAQ ACCORDION ===== */
|
|
function toggleFaq(btn) {
|
|
const item = btn.parentElement;
|
|
const answer = item.querySelector('.faq-a');
|
|
const isOpen = item.classList.contains('open');
|
|
|
|
// Close all
|
|
document.querySelectorAll('.faq-item').forEach(i => {
|
|
i.classList.remove('open');
|
|
const a = i.querySelector('.faq-a');
|
|
if (a) a.style.maxHeight = null;
|
|
});
|
|
|
|
// Open if was closed
|
|
if (!isOpen && answer) {
|
|
item.classList.add('open');
|
|
answer.style.maxHeight = answer.scrollHeight + 'px';
|
|
}
|
|
}
|