Solved

Image following cursor

Posted on 2004-09-07
5
515 Views
Last Modified: 2008-02-01
Hi Programmers!
I am not JavaScript programmer but I have to make a little script:
I need an small image that constantly follows a cursor.
Something like you move a cursor and with a small delay an image will follow it or something like that.

If possible then please help!!!

Okey, all the best!
0
Comment
Question by:PSERK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 11997879
0
 
LVL 8

Accepted Solution

by:
radnor earned 500 total points
ID: 11998166
http://javascript.internet.com/messages/mouse-trails.html

Change the image they provide (an arrow) to your image you should be good to go.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11998711
Here my version:


<html>
<head>
<script>
var imgCur = null;
function moveImg(e){
  if(!e){
    e=event;
  } else {
    e.x = e.pageX;
    e.y = e.pageY;
  }
  setTimeout("imgCur.style.left='"+e.x+"px';imgCur.style.top='"+e.y+"px'", 100);
  status="imgCur.style.left='"+e.x+"px';imgCur.style.top='"+e.y+"px'";
}
function intitCur(){
  imgCur=document.images.curImg;
  if(!document.all)
    document.captureEvents(Event.MOUSEMOVE);
  document.onmousemove=moveImg;
}
</script>
</head>
<body onLoad="intitCur()">
<img name="curImg" style="position:absolute;" src="http://experts-exchange.com/images/vipAccess.gif">
</body>
</html>


0
 
LVL 63

Expert Comment

by:Zvonko
ID: 11998717
Sorry, remove the window.status line. It was only for debugging.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question