Q:

Select areas of an image with Jquery

I started a web application with C# and mvc5.
In my application I read images from database and show them in an image slider.
I want to add a button to the page and when user click on this button User can click on one area of image and I save this x and y of area to the database.
my problem is I dont know how can I get the x and y with any resolution of devices. Maybe user use Iphone maybe Ipad or maybe imac.

A:

You can get and store the Positions with a click event as shown below:
function getClickPosition(e) {
    var cursorX = e.pageX;
    var cursorY = e.pageY;
}

document.addEventListener("click", getClickPosition);

The viewport size will be irrelevant as it will return the X and Y position for that specific viewport in px. 

