Solved

Image following cursor

Posted on 2004-09-07
5
505 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Javascript loop through list 13 34
Location of Javascript on HTML page 3 26
Python On Mouseover Save URL/Link 4 35
Asp.net mvc 5 5 22
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now