// 右飘开?
document.writeln(" ");
document.writeln("");
document.writeln("
");
// 左飘开?
document.writeln(" ");
document.writeln("");
document.writeln(" ");
//乱悬移动跑
document.writeln("");
(function () {
const ad = document.getElementById('floating-ad');
let x = Math.random() * (window.innerWidth - 80);
let y = Math.random() * (window.innerHeight - 80);
let dx = 0.8; // 原来?2Q越越?
let dy = 0.6;
let moving = true;
// 初始化位|?
ad.style.left = x + 'px';
ad.style.top = y + 'px';
function move() {
if (!moving) return;
x += dx;
y += dy;
// 撞边界反弹
if (x <= 0 || x >= window.innerWidth - 80) dx = -dx;
if (y <= 0 || y >= window.innerHeight - 80) dy = -dy;
ad.style.left = x + 'px';
ad.style.top = y + 'px';
requestAnimationFrame(move);
}
// 鼠标悬停暂停
ad.addEventListener('mouseover', () => { moving = false; });
ad.addEventListener('mouseout', () => {
if (!moving) {
moving = true;
move();
}
});
move(); // 启动Ud
})();
//乱悬移动跑 ǿƵ