Ini Ada sedikit trik bagaimana mencari Posisi Mouse Dengan JQUERY,
Listing Programmnya :
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
$(document).mousemove(function(e){
$('#status').html(e.pageX +', '+ e.pageY);
});
})
</script>
<body>
<h2 id="status">
0, 0
</h2>
</body>
</html>
Ini Contohnya :
0, 0
Silahkan Klik Dimana Saja :)
Ini Adalah Source Codenya Contohnya :
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
$("#special").click(function(e){
$('#status2').html(e.pageX +', '+ e.pageY);
});
})
</script>
<body>
<h2 id="status2">
0, 0
</h2>
<div style="width: 100px; height: 100px; background:#ccc;" id="special">
Silahkan Klik Dimana Saja :)
</div>
</body>
</html>
Selamat Mencoba Mas Bro.... :)
Tidak ada komentar:
Posting Komentar