Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Finding mouse cordinate by JQuery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 157
    Comment on it

    By using jquery event.pageX and event.pageY we find the coordinate of mouse. The PageX event shows the edges from left and the PageY event shows the edges from top.

    <!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>event.pageX demo</title>
      <style>
      body {
        background-color: #eef;
      }
      div {
        padding: 20px;
      }
      </style>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    </head>
    <body>
    
    <div id="log"></div>
    
    <script>
    $( document ).on( "mousemove", function( event ) {
      $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
    });
    </script>
    
    </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: