By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,116 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

Get relative coords of clicked image

P: n/a
I have a image in a scrollable DIV. The image is bigger than the display
size of the DIV. How do I get the coordinates of a mouse click on the
image relative to the top left corner of the image itself?

Andrew Poulos
Aug 6 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Andrew Poulos wrote:
I have a image in a scrollable DIV. The image is bigger than the display
size of the DIV. How do I get the coordinates of a mouse click on the
image relative to the top left corner of the image itself?
Handle the `click' event of the `img' element and subtract the image's
coordinates that are relative to the viewport's top left corner from the
pointer coordinates that are relative to the viewport's top left corner.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Aug 6 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.