jquery当中bind和unbind,pageX,pageY,.screenX, screenY是怎么用的?

例 2.2(e.pageXscreenX.html)

<html>
<head>
<script language="javascript" src="jquery.min.js"></script>
<script language="javascript">
$(function(){undefined
/*马克-to-win:和原来一样,pageX指窗口里,screenX指屏幕,所以多了一个上面的菜单。*/
    $("body").bind("click", fn1 = function(e){   
        var posPage = "(" + e.pageX + "," + e.pageY + ")";
        var posScreen = "(" + e.screenX + "," + e.screenY + ")";
        $("span").html("<br>Page: " + posPage + "<br>Screen: " + posScreen);
    });
    $("input[type=button]").click(function(){undefined
        $("body").unbind("click",fn1);    //移除事件监听myFunc1
    });
});
</script>
</head>
<body>
sgkls<br>
sfdgsdg<br>
gf<br>
fsdf<br>
fgdsf<br>
sdf<br>
sdfdsf<br>
sdfsd<br>
<input type="button" value="移除事件1">
<span></span>
</body>
</html>


更多内容请见原文,文章转载自:https://blog.csdn.net/qq_44594371/article/details/103062825

posted @ 2022-01-06 19:15  malala  阅读(79)  评论(0编辑  收藏  举报