Skip to content Skip to sidebar Skip to footer

How To Rotate Image In Relation To Mouse Position?

I'm trying to do this effect: http://metatroid.com/articles at the top of the page but I can't get it to rotate with just the code they given. var img = $('.image'); if(img.leng

Solution 1:

Problem is that you only define the function mouse, and only set the event handler, if img.length is > 0. The script is located in the head, and executed before the body can load, so there is no image.

Fix - move the script into the body of the document after the where the image is defined. Also, your fiddle doesn't include jQuery (mootools instead). Once you fix those two things it will work.

Post a Comment for "How To Rotate Image In Relation To Mouse Position?"