当前位置:网站首页>Js- get the mouse coordinates and follow them
Js- get the mouse coordinates and follow them
2022-06-25 14:54:00 【-multiflora-】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
#box1{
width: 100px;
height: 100px;
background-color: #bbffaa;
/* Turn on box1 The absolute positioning of */
position: absolute;
}
</style>
<script type="text/javascript">
window.onload = function (){
/* * bring div You can follow the mouse * */
var box1 = document.getElementById("box1");
document.onmousemove = function (event){
// Solve compatibility problems
event = event || window.event
// Get mouse coordinates
var left = event.pageX;
var top = event.pageY;
// Set up div The offset
box1.style.left = left + "px";
box1.style.top = top + "px";
}
}
</script>
</head>
<body>
<div id="box1"></div>
</body>
</html>

边栏推荐
- Ideal L9 in the eyes of the post-90s: the simplest product philosophy, creating the most popular products
- [untitled] PTA check password
- Sequential programming 1
- 分饼干问题
- Yolov3 spp Darknet version to caffemodel and then to OM model
- Jaspersoft studio installation
- Std:: vector minutes
- Qmake uses toplevel or topbuilddir
- Share the code technology points and software usage of socket multi client communication
- Character encoding minutes
猜你喜欢

Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat

Uniapp icon configuration

Sequential programming 1

Add the resources directory under test in idea

Power automatic test system nsat-8000, accurate, high-speed and reliable power test equipment

Application of TSDB in civil aircraft industry

SPARQL learning notes of query, an rrdf query language

搭建极简GB28181 网守和网关服务器,建立AI推理和3d服务场景,然后开源代码(一)

【Try to Hack】vulnhub DC1

弹性布局(display:flex;)属性详解
随机推荐
How to make GIF animation online? Try this GIF online production tool
Get the parameters in the URL and the interchange between parameters and objects
Daily question, Caesar code,
Biscuit distribution
Modal and modeless dialogs for QT
Build a minimalist gb28181 gatekeeper and gateway server, establish AI reasoning and 3D service scenarios, and then open source code (I)
How to combine multiple motion graphs into a GIF? Generate GIF animation pictures in three steps
JGG | 河北大学杜会龙组综述植物泛基因组学研究
How to cut the size of a moving picture? Try this online photo cropping tool
如何裁剪动图大小?试试这个在线照片裁剪工具
What is the difference between escape, encodeuri and encodeuricomponent?
Biscuit distribution
C language escape character and its meaning
Function of getinstance() method
有哪个瞬间让你觉得这个世界出bug了?
Disable scrolling in the iPhone web app- Disable scrolling in an iPhone web application?
90 后眼中的理想 L9:最简单的产品哲学,造最猛的爆款 | 指南斟
Open a restaurant
Output 0 ~ n digits and output multiple times
Where is it safe to open an account for buying funds? Ask for guidance