Welcome visitor
* Login
* Register
It is currently March 24th, 2019, 1:01 am
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  move an image along with the mouse
PostPosted: December 9th, 2009, 7:29 pm 

Posts: 22
do you know if there's a way to make an image follow the mouse across the screen?


Top
 Profile  
 
  Re: move an image along with the mouse
PostPosted: December 9th, 2009, 8:35 pm 
User avatar

Posts: 81
Well, there's a huge issue with browser compatibility. This script works in firefox and opera only.
<script type="text/javascript">
document.onmousemove = findPos;
function findPos(e){
  px=e.pageX;
  py=e.pageY;
  document.getElementById('thispic').innerHTML='<div id="thispic" style="position: absolute; top: '+py+'px; left: '+px+'px"><img src="k.jpg" /></div>';
}
</script>
<div id="thispic" ><img src="iamnge.jpg" /></div>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron