SoFunction
Updated on 2025-02-28

javascript mouse drag icon technology


<body>
<div style="width:100px; height:100px; position:relative; background-color:#FF0000";></div>
<script>
var bb = ("block");
= function(){
//Get the current coordinate of the mouse
var pageX = ;
var pageY = ;
//Get the coordinates of the block, the left boundary and the upper boundary
var offX = parseInt()||0;
var offY = parseInt()||0;
// Calculate the spacing between mouse coordinates and block coordinates
var offLX = pageX-offX;
var offLY = pageY-offY;
if(!){
= function(){
=-offLX; //Set the X coordinate of the block
=-offLY; //Set the Y coordinate of the block
}
}
}
= function(){ = null;} //The mouse pops up
</script>
</body>