JS---案例:图标跟着鼠标飞(有bug)
案例:图标跟着鼠标飞(有bug)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>title</title> <style> img { position: absolute; } </style> </head> <body> <img src="images/tianshi.gif" alt="" id="im"> <script src="common.js"></script> <script> //鼠标在页面中移动,图片跟着鼠标移动 document.onmousemove = function (e) { //鼠标的移动的横纵坐标 //可视区域的横坐标 //可视区域的纵坐标 my$("im").style.left = e.clientX + "px"; my$("im").style.top = e.clientY + "px"; }; </script> </body> </html>
你好,我是Jane,如果万幸对您有用,请帮忙点下推荐,谢谢啦~另外,咱们闪存见哦~