// 假设这是您的二级菜单数据 const menuItems = [ { img: "/uploadfile/image/20250610/85da29e95.jpg", link: "https://CCCALFA.com", text: "CCCALFA" }, { img: "/uploadfile/image/20250607/b99b5bdfc.jpg", link: "https://AAAALFA.com", text: "AAAALFA" }, { img: "/uploadfile/image/20250604/a42928887.png", link: "https://111ALFA.com", text: "111ALFA" }, { img: "/uploadfile/image/20250603/15e1e0441.png", link: "https://333alfa.com", text: "333alfa" }, { img: "/uploadfile/image/20250603/289aabf99.png", link: "https://555alfa.com", text: "555ALFA" }, { img: "/uploadfile/image/20250603/3518f188d.png", link: "https://666alfa.com", text: "666ALFA" }, { img: "/uploadfile/image/20250603/6cdd486f7.png", link: "https://999alfa.com", text: "999ALFA" }, { img: "/uploadfile/image/20250603/e24dc297f.png", link: "https://OLAALFA.com", text: "OLAALFA" }, { img: "/uploadfile/image/20250603/313866d6d.png", link: "https://xuxa777.com", text: "XUXA777" }, { img: "/uploadfile/image/20250603/650c6a2d2.png", link: "https://tampg.com", text: "TAMPG" }, { img: "/uploadfile/image/20250603/3ddab57b2.png", link: "https://vult777.com", text: "VULT777" }, { img: "/uploadfile/image/20250603/64a74a383.png", link: "https://belapg.com", text: "belapg" }, { img: "/uploadfile/image/20250603/ce1f8fb54.png", link: "https://Liz777.bet", text: "Liz777" }, { img: "/uploadfile/image/20250603/cc167f762.png", link: "https://rbd777.com", text: "RBD777" }, { img: "/uploadfile/image/20250603/13a38a2b4.png", link: "https://OXXO777.COM", text: "OXXO777" }, { img: "/uploadfile/image/20250603/e1821df5f.png", link: "https://ampm777.com", text: "AMPM777" }, { img: "/uploadfile/image/20250603/f84380748.png", link: "https://LUPO777.com", text: "LUPO777" }, ]; // 动态创建二级菜单项并为第一排的四个圆圈外部添加角标 function createMenuItems(items) { const container = document.getElementById('menuContainer'); container.innerHTML = ''; // 确保每次创建新项前清空容器 items.forEach((item, index) => { const col = document.createElement('div'); col.className = 'col-3'; col.innerHTML = `
`; container.appendChild(col); }); } // 通过搜索,动态创建二级菜单项 function searchItems(items) { const keyword = $('#search-box input').val().toLowerCase(); const container = document.getElementById('menuContainer'); container.innerHTML = ''; // 清空容器 if (keyword) { items.forEach((item, index) => { if (item.text.toLowerCase().includes(keyword)) { const col = document.createElement('div'); col.className = 'col-3'; col.innerHTML = ` `; container.appendChild(col); } }); } else { createMenuItems(items); } } // 在页面加载完成后执行 window.onload = function () { createMenuItems(menuItems); const searchInput = $('#search-box input'); searchInput.on('input', function () { searchItems(menuItems); }); };