Mr_Green
Mr_Green

Reputation: 41872

jquery onmouseover function

i need to rotate an image onmouseover function using Jquery

file.js

$("#logo").rotate({
        bind:
         {
             mouseover: function () 
             {$(this).rotate({ animateTo: 180 })},
             mouseout: function () 
             {$(this).rotate({ animateTo: 0 })}
        }
 });

HTML

<script type="text/javascript" src="../script/file.js"></script>
<img id="logo" src="../images/logo.png" alt="none" /> 

Is there anything wrong in this code? BTW, I found this code on the internet. There is no function call as rotate() in JavaScript then how can it work? Please give any link so that I can understand.

Please ignore this question if it looks like a foolish thing to ask :)

Upvotes: 0

Views: 598

Answers (3)

Download jquery.rotate.1-1.js from here http://code.google.com/p/jquery-rotate/downloads/list and include it in a script tag before this call.

Upvotes: 0

Endy
Endy

Reputation: 696

It looks like you are attempting to use some code snippet that is using a custom JQuery plugin.

There is no built-in function for rotating images in JQuery. There are plenty of plugins available for that, e.g. http://code.google.com/p/jquery-rotate/ and http://code.google.com/p/jqueryrotate/.

Upvotes: 0

Mark Pieszak - Trilon.io
Mark Pieszak - Trilon.io

Reputation: 67211

.rotate() isn't a function. Are you referencing whatever plugin this is correctly? This must be what's causing the issue.

Upvotes: 1

Related Questions