元素上 document.documentElement.style.fontSize = baseFontSize; } // 轮播图初始化 var mySwiper = new Swiper('.swiper', { loop: true, // 循环模式选项 autoplay: { delay: 3000, stopOnLastSlide: false, disableOnInteraction: true, }, // // 如果需要分页器 pagination: { el: '.swiper-pagination', }, }) // 公告悬浮窗和悬浮球的显示隐藏 $('.right_arrow').click(function () { $('.left_arrow').show() $('.announcement').hide() }) $('.left_arrow').click(function () { $('.left_arrow').hide() $('.announcement').show() }) // 手风琴 const imgContainers = document.querySelectorAll('.accordion_img'); imgContainers.forEach(function (container) { var deviceWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; if(deviceWidth > 992){ container.addEventListener('click', function () { imgContainers.forEach(function (c) { if (c === container) { c.style.width = 'calc(3.91rem * 0.8)'; c.querySelector('.title').style.fontSize = '27px'; c.querySelector('.button').style.display = 'block'; } else { c.style.width = 'calc(1.69rem * 0.8)'; c.querySelector('.title').style.fontSize = '20px'; c.querySelector('.button').style.display = 'none'; } }); }); } }); // 移动端遮罩层点击展开 function openNav() { document.getElementById("myNav").style.width = "100%"; document.getElementById("body").style.overflow = "hidden"; } // 移动端遮罩层点击收起 function closeNav() { document.getElementById("myNav").style.width = "0%"; }