initial commit
This commit is contained in:
commit
edc022c895
14 files changed
+1872
No files matched your search
@@ -0,0 +1,72 @@
|
||||
// ===== Cookie Banner =====
|
||||
(function() {
|
||||
const banner = document.getElementById('cookieBanner');
|
||||
const acceptBtn = document.getElementById('cookieAccept');
|
||||
if (!banner || !acceptBtn) return;
|
||||
|
||||
const consent = localStorage.getItem('olyapka_cookies_consent');
|
||||
if (!consent) {
|
||||
setTimeout(() => banner.classList.add('show'), 800);
|
||||
} else {
|
||||
banner.classList.add('hidden');
|
||||
}
|
||||
|
||||
acceptBtn.addEventListener('click', function() {
|
||||
localStorage.setItem('olyapka_cookies_consent', '1');
|
||||
banner.classList.remove('show');
|
||||
setTimeout(() => banner.classList.add('hidden'), 400);
|
||||
// Goal for Yandex.Metrika
|
||||
if (typeof ym !== 'undefined') ym(110606131, 'reachGoal', 'cookie_accept');
|
||||
if (typeof gtag !== 'undefined') gtag('event', 'cookie_accept');
|
||||
});
|
||||
})();
|
||||
|
||||
// ===== Mobile Menu =====
|
||||
(function() {
|
||||
const burger = document.getElementById('burger');
|
||||
const nav = document.getElementById('nav');
|
||||
if (!burger || !nav) return;
|
||||
|
||||
burger.addEventListener('click', function() {
|
||||
burger.classList.toggle('open');
|
||||
nav.classList.toggle('open');
|
||||
});
|
||||
|
||||
// Close on link click
|
||||
nav.querySelectorAll('.nav-link').forEach(link => {
|
||||
link.addEventListener('click', () => {
|
||||
burger.classList.remove('open');
|
||||
nav.classList.remove('open');
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
// ===== Goal Tracking (Yandex.Metrika + GA) =====
|
||||
(function() {
|
||||
document.addEventListener('click', function(e) {
|
||||
const target = e.target.closest('[data-goal]');
|
||||
if (!target) return;
|
||||
const goal = target.getAttribute('data-goal');
|
||||
if (!goal) return;
|
||||
|
||||
// Yandex.Metrika
|
||||
if (typeof ym !== 'undefined') {
|
||||
try { ym(110606131, 'reachGoal', goal); } catch(err) {}
|
||||
}
|
||||
// Google Analytics
|
||||
if (typeof gtag !== 'undefined') {
|
||||
try { gtag('event', goal); } catch(err) {}
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
// ===== Smooth scroll for anchor links =====
|
||||
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
||||
anchor.addEventListener('click', function(e) {
|
||||
const target = document.querySelector(this.getAttribute('href'));
|
||||
if (target) {
|
||||
e.preventDefault();
|
||||
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user