jquery获取鼠标移动时的位置

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>jquery获取鼠标的位置</title>
<meta name="author" content="DeathGhost" />
<style>
    
    
</style>
<script src="jquery.js"></script> 
<script src="get.js"></script> 
</head>
    <body style="width:1000px;height:1000px">
        
    </body>
</html>

get.js:

$(function(){
        $("body").mousemove(function(e){
            console.info("x :" + e.pageX);
            console.info("y :" + e.pageY);
        });
});

效果:

猜你喜欢

转载自www.cnblogs.com/1998xujinren/p/12340957.html
今日推荐