Hey everybody!
Im studying javascript, and I tried to make a script for a image follow the cursor. The script calculate the coordinate of the cursor, but I cant put a coordinate in a css (style.left = coordinate_x)
What can I do?
Thanks!
Hey everybody!
Im studying javascript, and I tried to make a script for a image follow the cursor. The script calculate the coordinate of the cursor, but I cant put a coordinate in a css (style.left = coordinate_x)
What can I do?
Thanks!
Either give us a link to your page or post the code here. It's too hard to guess what you are doing.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Djr33 - he wants to make an image follow a cursor.
I hope you're using client(X, Y) and page(X, Y) including additional things. Anyways - just change the css within the Javascript:
Code:document.getElementById('element').style.position = "absolute"; document.getElementById('element').style.left = posX; document.getElementById('element').style.top = posY;
Jeremy | jfein.net
Code:document.getElementById('element').style.position = "absolute"; document.getElementById('element').style.left = posX+'px'; document.getElementById('element').style.top = posY+'px';
Vic
God Loves You and will never love you less.
http://www.vicsjavascripts.org/Home.htm
If my post has been useful please donate to http://www.operationsmile.org.uk/
Aha - good point. Maybe parseInt() is also essential? I wouldn't know that much about this though.
Jeremy | jfein.net
Bookmarks