App下載
首頁javascriptdrawing_settingsCanvas - 如何在畫布上隱藏鼠標(biāo)

Canvas - 如何在畫布上隱藏鼠標(biāo)

我們想知道如何在畫布上隱藏鼠標(biāo)。


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'></script>
<style type='text/css'>
    canvas{border:1px solid red;}
</style>
<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){
     $("#theCanvas").click(function () {
         alert("You clicked the canvas with an invisible mouse!");
         $("#theCanvas").css("cursor", "none");
     });
});//]]>  
</script>
</head>
<body>
   <p">Click the red canvas and I'll hide the cursor when you are over me</p>
   <canvas id="theCanvas"></canvas>
</body>
</html>