首页 > 其他分享 >JQuery鼠标跟随效果

JQuery鼠标跟随效果

时间:2022-11-23 13:40:26浏览次数:37  
标签:JQuery function 鼠标 float 100px 跟随 css


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script src="jquery-1.3.2.min.js" type="text/javascript"></script>

    <style type="text/css">
        #float
        {
            position: absolute;
            width: 100px;
            height: 50px;
            border: solid 1px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="float">
        鼠标跟随效果
    </div>
    </form>

    <script type="text/javascript">
        $(function() {
            $(document).mousemove(function(e) {
                $("#float").css("left", e.pageX).css("top", e.pageY);
            });
        });
    </script>

</body>
</html>

标签:JQuery,function,鼠标,float,100px,跟随,css
From: https://blog.51cto.com/u_1236522/5881158

相关文章