How can I get height form “window top” to “my click point on window” using css or jquery or php?
Hi,
Problem is:
I am displaying popup window on my web page screen but position of popup-window is going to change.I want to this center where I clicked. So I want to find out the height, but I’m unable to get height.
Please give me solution or any alternative of this.
Thanks in advance
This is a short little jQuery-based script that moves an element to wherever the mouse was clicked:
You can see it work here (along with the relevant HTML/CSS): http://jsfiddle.net/jfriend00/4p7xJ/
There are a number of different mouse coordinate positions in the event passed to the jQuery click handler. Among them are pageX, pageY, screenX, screenY, clientX and clientY. You can look each of these up in MDN to see the detail description of each to decide which you want. If you’re trying to position something relative to the clicked-on content (including scrolling position), then you probably want pageX and pageY like I used in my example.