开发者

Mouse events in JavaScript?

开发者 https://www.devze.com 2023-03-08 01:30 出处:网络
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 canva

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

0

精彩评论

暂无评论...
验证码 换一张
取 消