Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6579133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:51:37+00:00 2026-05-25T15:51:37+00:00

I have a square image/graph on which the user clicks. Is there a way

  • 0

I have a square image/graph on which the user clicks.

Is there a way to display the (x,y) coordinates of the cursor to the user in real-time whenever the user hovers over the image (user does not need to click on the image)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:51:38+00:00Added an answer on May 25, 2026 at 3:51 pm

    Here you go:

    HTML:

    <img class="coords" src="http://i.imgur.com/bhvpy.png">
    

    JavaScript:

    var tooltip = $( '<div id="tooltip">' ).appendTo( 'body' )[0];
    
    $( '.coords' ).
        each(function () {
            var pos = $( this ).position(),
                top = pos.top,
                left = pos.left,
                width = $( this ).width(),
                height = $( this ).height();
    
            $( this ).
                mousemove(function ( e ) {
                    var x, y;
    
                    x = ( ( e.clientX - left ) / width ).toFixed( 1 ),
                    y = ( ( height - ( e.clientY - top ) ) / height ).toFixed( 1 );
    
                    $( tooltip ).text( x + ', ' + y ).css({
                        left: e.clientX - 30,
                        top: e.clientY - 30
                    }).show();
                }).
                mouseleave(function () {
                    $( tooltip ).hide();
                }); 
        });
    

    Live demo: http://jsfiddle.net/pSVXz/12/

    With my updated code, you can have multiple images with this functionality – just add the class "coords" to the images.

    Note: This code has to be inside the load handler (instead of the ready) handler, because we have to read the image’s dimensions which we can only do for fully loaded images.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an image which is square 100px by 100px. Was wondering if there
I have a PHP image upload system which allows a user to upload various
Lets say I have a non-square image.. If I increment the width and I
In the design of my app, I have a square space for an image
let's say we have an image that contain square,circle and other few object at
Here is the page I have a problem with on each image (little square)
I have an image with a square... In layout I want to set text
I have a png, when I save it it is a square image, but
I'm looking for the most efficient way to 'square' an image for use as
I basically have a square image depicting a diagram and what I would like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.