0

I'm a bit of a NOOB to Jquery.

I've used the Jquery click handler on an image and am finding that when the page is scrolled, that position is out by however much the page is been scrolled. is this correct? how do I get the relative position of the mouseclick?

my code is at http://www.mars-tourist-guide.co.uk/curiosity/imgtag.html in which when you click on an image a red box should appear where the mouse was clicked.

I'm using poEvent.clientX, poEvent.clientY but I suspect thats not right

Thanks

1 Answers1

0

I've also had this problem (a long time ago) and these questions helped me: https://stackoverflow.com/a/9335517/3132718
https://stackoverflow.com/a/17705548/3132718

Community
  • 1
  • 1
Al.G.
  • 4,327
  • 6
  • 31
  • 56
  • Thanks it helped a little but I think I've cracked it now. Also I was positioning the objects using offset() but that gave me a problem as when I deleted an object, all the others moved. now I'm using css({position: 'absolute', top: ""+iY+"px", left: ""+iX+"px"}) and not having that problem – user2795488 Mar 22 '14 at 15:51