// 检测是否为移动端 function isMobile() { return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); } // 如果是移动端且当前不是 mobile 页面,则重定向到移动端页面 // if (isMobile()) { // // 如果是移动端,将 xxx.html 替换为 xxx-mob.html // var currentPath = window.location.pathname; // if (currentPath.endsWith('.html') && !currentPath.includes('-mob.html')) { // var newPath = currentPath.replace(/\.html$/, '-mob.html'); // window.location.href = newPath; // } // } else { // // 如果是桌面端,将 xxx-mob.html 替换为 xxx.html // var currentPath = window.location.pathname; // if (currentPath.endsWith('-mob.html')) { // var newPath = currentPath.replace(/-mob\.html$/, '.html'); // window.location.href = newPath; // } // } setTimeout(function () { isMobile() && toggleNav('close'); },1000); function toggleNav(status) { $('.download-footer, .nav-links, .assets-banner, .sidenav').hide(); $(".article-pc").addClass("article").removeClass("article-pc"); $(".content-pc").addClass("content").removeClass("content-pc"); var elements = document.getElementsByClassName('common-navbar-wrapper'); if(status == 'open') { elements[0].innerHTML = `

简体中文

`; // $(document).ready(function() { // 监听 ant-menu 下的 li 元素点击事件 $('.ant-menu li').on('click', function(e) { // 阻止事件冒泡(避免触发父菜单的点击事件) e.stopPropagation(); // 获取当前点击的 li 元素 const $li = $(this); // 1. 切换 ant-menu-submenu-open 类(控制展开/折叠样式) $li.toggleClass('ant-menu-submenu-open'); // 2. 查找当前 li 下的子菜单(ant-menu),并切换 ant-menu-hidden const $subMenu = $li.find('> .ant-menu'); if ($subMenu.length) { $subMenu.toggleClass('ant-menu-hidden'); } }); }); $(document).ready(function() { $('.common-navbar img').on('click', function() { toggleNav('close'); }); }); }else{ elements[0].innerHTML = `
`; $(document).ready(function() { $('.common-navbar img').on('click', function() { toggleNav('open') }); }); } }