// 移动端菜单切换 document.querySelector('.md\\:hidden').addEventListener('click', function() { const nav = document.querySelector('nav'); nav.classList.toggle('hidden'); nav.classList.toggle('flex'); nav.classList.toggle('flex-col'); nav.classList.toggle('absolute'); nav.classList.toggle('top-16'); nav.classList.toggle('left-0'); nav.classList.toggle('w-full'); nav.classList.toggle('bg-white'); nav.classList.toggle('shadow-md'); nav.classList.toggle('p-4'); nav.classList.toggle('space-y-4'); }); // 页面滚动效果 window.addEventListener('scroll', function() { const header = document.querySelector('header'); if (window.scrollY > 50) { header.classList.add('py-2'); header.classList.remove('py-4'); } else { header.classList.add('py-4'); header.classList.remove('py-2'); } }); // 平滑滚动 document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault(); const targetId = this.getAttribute('href'); if (targetId === '#') return; const targetElement = document.querySelector(targetId); if (targetElement) { targetElement.scrollIntoView({ behavior: 'smooth' }); } }); }); // 监听翻译完成事件 document.addEventListener('googleTranslateElementInit', function() { setTimeout(() => { const alertBox = document.createElement('div'); alertBox.className = 'fixed top-4 right-4 bg-green-500 text-white px-4 py-2 rounded shadow-lg z-50'; alertBox.textContent = '页面已翻译为 ' + document.documentElement.lang; document.body.appendChild(alertBox); setTimeout(() => { alertBox.style.opacity = '0'; alertBox.style.transition = 'opacity 0.5s'; setTimeout(() => alertBox.remove(), 500); }, 3000); }, 500); }); // 移动端翻译组件优化 function adjustGoogleTranslateForMobile() { if (window.innerWidth < 768) { const translateElement = document.getElementById('google_translate_element'); if (translateElement) { translateElement.classList.add('text-sm'); } } } window.addEventListener('resize', adjustGoogleTranslateForMobile); adjustGoogleTranslateForMobile(); // 初始化时调用 } -->
Home Media

News, Information and Reports Related to Europe

Europe

About Europe global trade information, exclusive product market analysis, hot news and reports.