Image Position on page

Forgive me if this is really easy but i’m new to Velo and i’ve not been able to find an answer. I’m looking for way to find out where an image is on a page, (the x and y coordinates). I don’t need to be able to move the image, just to know where it is.

Thanks

If it’s related to event (for example: onClick), you can do something like:

$w('#image').onClick(event => {
const {pageX, pageY, screenX, screenY, clientX, clientY, offsetX, offsetY} = event;
//then do whatever you want with these variables.
})

But if you need to get location without any event, you’ll have to create your own elements using custom element.

Thanks that’s exactly what I needed

You’re welcome.

And if f you don’t know what the difference between these values you can see in here:
https://i.stack.imgur.com/S8LFi.png

  • and here:

https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/offsetX