Positioning a div under cursor/pointer

P

paulsilver

Hi, can someone please help me, I'd like to position a div under the
mouse pointer when a link is clicked. I have something which'll do this
in Firefox (see http://www.paulsilver.co.uk/test/div_by_pointer.html
[1]) but when using IE it breaks when you scroll down the page - the
div appears much further up the page than it should.

Can anyone either let me know how to fix it, or point me towards
something better? I've been Googling a lot, but can only find other
problems, or people with the same problem who say "Oh, I've fixed it
now" but unfortunately not how they did it.

Thanks very much

Paul
[1] Script originally from:
http://www.willmaster.com/blog/css/Floating_Layer_At_Cursor_Position.html
 
R

RobG

paulsilver said:
Hi, can someone please help me, I'd like to position a div under the
mouse pointer when a link is clicked. I have something which'll do this
in Firefox (see http://www.paulsilver.co.uk/test/div_by_pointer.html
[1]) but when using IE it breaks when you scroll down the page - the
div appears much further up the page than it should.

Can anyone either let me know how to fix it, or point me towards
something better? I've been Googling a lot, but can only find other
problems, or people with the same problem who say "Oh, I've fixed it
now" but unfortunately not how they did it.

You seem to have an issue with the cursor position - quirksmode should help:

<URL:http://www.quirksmode.org/js/events_properties.html>
 
P

Paul Silver

RobG said:
paulsilver said:
Hi, can someone please help me, I'd like to position a div under the
mouse pointer when a link is clicked. I have something which'll do this
in Firefox (see http://www.paulsilver.co.uk/test/div_by_pointer.html
[1]) but when using IE it breaks when you scroll down the page - the
div appears much further up the page than it should.

Can anyone either let me know how to fix it, or point me towards
something better? I've been Googling a lot, but can only find other
problems, or people with the same problem who say "Oh, I've fixed it
now" but unfortunately not how they did it.

You seem to have an issue with the cursor position - quirksmode should help:

<URL:http://www.quirksmode.org/js/events_properties.html>

Thank you very much Rob, I was able to use some code from that page to
replace the positioning code I had, which has helped it work.

(Once I've finished the project I'll write that up for anyone like me
who's been searching in vain.)

Thanks again

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top