Mouse events in JavaScript?
How would I go about making an image follow the mouse using J开发者_如何学编程avaScript? I'm currently working with the new HTML5 canvas element. (The image I want the mouse to follow is on the canvas, I just want it to follow the mouse's position.)
You can tie the image's position to the onmousemove
event, you can see my demo here for doing that with regular JavaScript: http://jsbin.com/ogabi3/2
Things like jQuery UI's position utility will help provide collision detection with the browser
精彩评论