我的网盘
// ========== 修复:鼠标跟随逻辑(替换所有图片链接) ========== // 1. 基础版:单个奶瓶跟随 const follower = document.getElementById('mouse-follower'); if (follower) { // 确保容器存在 const bottle = document.createElement('img'); bottle.src = 'https://cdn.jsdelivr.net/gh/666david999/abdl-static@main/icons/bottle.png'; bottle.className = 'follower-bottle'; bottle.alt = '奶瓶'; // 增加alt,确保可访问性 bottle.onerror = function() { // 图片加载失败的备用方案 this.src = 'https://img.icons8.com/fluency/96/baby-bottle.png'; // 备用图标 }; follower.appendChild(bottle); document.addEventListener('mousemove', (e) => { follower.style.left = `${e.clientX + 10}px`; follower.style.top = `${e.clientY + 10}px`; }); } // 2. 进阶版:多个随机元素跟随 const followerGroup = document.getElementById('mouse-follower-group'); const followerTypes = [ { src: 'https://cdn.jsdelivr.net/gh/666david999/abdl-static@main/icons/bottle-small.png', deg: -5, scale: 0.8, alt: '小奶瓶' }, { src: 'https://cdn.jsdelivr.net/gh/666david999/abdl-static@main/icons/diaper-small.png', deg: 8, scale: 0.9, alt: '小尿布' }, { src: 'https://cdn.jsdelivr.net/gh/666david999/abdl-static@main/icons/rattle.png', deg: -3, scale: 1.0, alt: '摇铃' }, { src: 'https://cdn.jsdelivr.net/gh/666david999/abdl-static@main/icons/candy.png', deg: 5, scale: 0.8, alt: '糖果' } ]; let followerCount = 0; const maxFollower = 5; document.addEventListener('mousemove', (e) => { if (!followerGroup) return; // 容错:容器不存在则跳过 if (Math.random() > 0.7 && followerCount < maxFollower) { const randomType = followerTypes[Math.floor(Math.random() * followerTypes.length)]; const item = document.createElement('img'); item.src = randomType.src; item.alt = randomType.alt; item.className = 'follower-item'; item.onerror = function() { // 备用图标 this.src = `https://img.icons8.com/fluency/64/${['baby-bottle', 'baby-carriage', 'rattle'][Math.floor(Math.random()*3)]}.png`; }; item.style.setProperty('--rotate-deg', `${randomType.deg + Math.random() * 10 - 5}deg`); item.style.setProperty('--scale', `${randomType.scale + Math.random() * 0.1}`); item.style.left = `${Math.random() * 30 - 15}px`; item.style.top = `${Math.random() * 30 - 15}px`; followerGroup.appendChild(item); followerCount++; setTimeout(() => { item.remove(); followerCount--; }, 3000); } followerGroup.style.left = `${e.clientX + 15}px`; followerGroup.style.top = `${e.clientY + 15}px`; }); // 3. 优化版:笨拙拖拽奶嘴 const clumsyFollower = document.getElementById('clumsy-follower'); if (clumsyFollower) { const pacifier = document.createElement('img'); pacifier.src = 'https://cdn.jsdelivr.net/gh/666david999/abdl-static@main/icons/pacifier.png'; pacifier.className = 'clumsy-item'; pacifier.alt = '奶嘴'; pacifier.onerror = function() { // 备用图标 this.src = 'https://img.icons8.com/fluency/96/pacifier.png'; }; clumsyFollower.appendChild(pacifier); let isDragging = false; document.addEventListener('mousemove', (e) => { if (!isDragging) { clumsyFollower.style.left = `${e.clientX + 20 + Math.random() * 10}px`; clumsyFollower.style.top = `${e.clientY + 20 + Math.random() * 10}px`; } }); pacifier.addEventListener('mousedown', (e) => { e.preventDefault(); isDragging = true; pacifier.style.animation = 'none'; pacifier.style.transform = 'rotate(15deg) scale(1.1)'; }); document.addEventListener('mouseup', () => { if (isDragging) { isDragging = false; pacifier.style.animation = 'baby-clumsy-shake 2.5s infinite ease-in-out'; pacifier.style.transform = 'rotate(0deg) scale(1)'; clumsyFollower.style.transition = 'left 0.3s ease-in, top 0.3s ease-in'; setTimeout(() => { clumsyFollower.style.transition = 'left 0.2s ease-out, top 0.2s ease-out'; }, 300); } }); } // 其他原有逻辑(点击表情/漂浮元素等)不变,此处省略