03JavaScript programming practice to follow the road 2019-06-27_21-51-24 Pictures


18event-demo.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        img {
            width: 120px;
            height: 120px;
            border-radius: 50%;
            position: absolute;
        }
    </style>
</head>
<body>
    <img src="img/cxy.jpeg" alt="">
    <script>
        var oImg = document.querySelector("img");
        document.onmousemove = function(e) {
            var e = E || Event;
             var X = e.pageX;
             var Y = e.pageY;
             // set of image coordinates 
            oImg.style.left = (X - 60 ) +  " PX " ; 
            oImg.style.top = (Y - 60 ) +  " PX " ; 
        } 
    </ Script > 
</ body > 
</ HTML >

 

 

Guess you like

Origin www.cnblogs.com/HiJackykun/p/11108902.html