0

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 :)

Abijeet Patro
  • 2,842
  • 4
  • 37
  • 64
Mr_Green
  • 40,727
  • 45
  • 159
  • 271

3 Answers3

1

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

Mark Pieszak - Trilon.io
  • 61,391
  • 14
  • 82
  • 96
0

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/.

Endy
  • 698
  • 3
  • 11
0

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.

Victor 'Chris' Cabral
  • 2,135
  • 1
  • 16
  • 33