Demo: http://jsfiddle.net/H45uY/6/
What I'm trying to do here is make the top-left corner of the <div>
follow the mouse. The code works fine without the paragraph (see demo above), but when you add a paragraph, the <div>
is pushed up and the mouse is halfway down the side of the box. Why does the paragraph do this?
Thanks!
Take the 2-minute tour
×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
|
|||
|
If you remove |
|||
|
add top:0 and left:0 to the div style |
|||||
|
You dont need to subtract the offset.
This will put the box at the mouse position. |
|||
|