| |
|
| | |
| |
|
| | |
| | document.addEventListener('DOMContentLoaded', () => { |
| | |
| | const weatherWidget = document.createElement('weather-widget'); |
| | document.body.appendChild(weatherWidget); |
| |
|
| | |
| | const translations = { |
| | english: { |
| | welcome: "Discover Kyrgyzstan", |
| | explore: "Explore", |
| | destinations: "Destinations", |
| | tours: "Tours", |
| | contact: "Contact" |
| | }, |
| | kyrgyz: { |
| | welcome: "Кыргызстанды изилдеңиз", |
| | explore: "Изилдөө", |
| | destinations: "Жерлер", |
| | tours: "Турлар", |
| | contact: "Байланыш" |
| | } |
| | }; |
| |
|
| | const toggleLanguage = () => { |
| | const currentLang = document.documentElement.lang; |
| | const newLang = currentLang === 'en' ? 'ky' : 'en'; |
| | document.documentElement.lang = newLang; |
| | |
| | const elements = document.querySelectorAll('[data-translate]'); |
| | elements.forEach(el => { |
| | const key = el.getAttribute('data-translate'); |
| | el.textContent = translations[newLang][key]; |
| | }); |
| | }; |
| |
|
| | const languageBtn = document.getElementById('languageToggle'); |
| | if (languageBtn) { |
| | languageBtn.addEventListener('click', toggleLanguage); |
| | } |
| |
|
| | |
| | document.querySelectorAll('a[href^="#"]').forEach(anchor => { |
| | anchor.addEventListener('click', function (e) { |
| | e.preventDefault(); |
| | document.querySelector(this.getAttribute('href')).scrollIntoView({ |
| | behavior: 'smooth' |
| | }); |
| | }); |
| | }); |
| |
|
| | |
| | const observer = new IntersectionObserver((entries) => { |
| | entries.forEach(entry => { |
| | if (entry.isIntersecting) { |
| | entry.target.classList.add('animate-fadeIn'); |
| | } |
| | }); |
| | }, { threshold: 0.1 }); |
| |
|
| | document.querySelectorAll('section, .animate').forEach(el => { |
| | observer.observe(el); |
| | }); |
| | |
| | const toggleLanguage = () => { |
| | const elements = document.querySelectorAll('[data-translate]'); |
| | elements.forEach(el => { |
| | const key = el.getAttribute('data-translate'); |
| | if (el.textContent === translations.english[key]) { |
| | el.textContent = translations.russian[key]; |
| | } else { |
| | el.textContent = translations.english[key]; |
| | } |
| | }); |
| | }; |
| |
|
| | |
| | const translations = { |
| | english: { |
| | welcome: "Welcome to Kyrgyzstan", |
| | explore: "Explore" |
| | }, |
| | russian: { |
| | welcome: "Добро пожаловать в Кыргызстан", |
| | explore: "Исследовать" |
| | } |
| | }; |
| |
|
| | |
| | const languageBtn = document.getElementById('languageToggle'); |
| | if (languageBtn) { |
| | languageBtn.addEventListener('click', toggleLanguage); |
| | } |
| |
|
| | |
| | const contactForm = document.querySelector('#contact form'); |
| | if (contactForm) { |
| | contactForm.addEventListener('submit', (e) => { |
| | e.preventDefault(); |
| | alert('Thank you for your inquiry! We will contact you soon.'); |
| | contactForm.reset(); |
| | }); |
| | } |
| |
|
| | |
| | const observerOptions = { |
| | threshold: 0.1 |
| | }; |
| |
|
| | const observer = new IntersectionObserver((entries) => { |
| | entries.forEach(entry => { |
| | if (entry.isIntersecting) { |
| | entry.target.classList.add('fade-in'); |
| | observer.unobserve(entry.target); |
| | } |
| | }); |
| | }, observerOptions); |
| |
|
| | document.querySelectorAll('section').forEach(section => { |
| | observer.observe(section); |
| | }); |
| | }); |
| |
|
| | |
| | async function fetchPopularTours() { |
| | try { |
| | const response = await fetch('https://api.example.com/tours'); |
| | const data = await response.json(); |
| | return data; |
| | } catch (error) { |
| | console.error('Error fetching tours:', error); |
| | return []; |
| | } |
| | } |