Zaw Than oo
Zaw Than oo

Reputation: 9935

Rotating image by Jquery

I am testing image rotating by jquery. Reference is here (Example 5). What is it missing in my code, image does not rotate when I click?

<html>
    <head>
        <title>Rotate Image</title>
        <script type="text/javascript" src="jquery.js"/>
        <script type="text/javascript" src="jQueryRotate.js"/>
    </head>
    <body>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#image").rotate({ 
                   bind: 
                     { 
                        click: function(){
                            $(this).rotate({ angle:0,animateTo:180,easing: $.easing.easeInOutExpo })
                        }
                     } 

                });
            });
        </script>   
        <img src="images/aaa1.jpg" id="image"/> 
    </body>
</html>

package :

enter image description here

Upvotes: 1

Views: 321

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

You missed to include jQuery core

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.js"></script>
<script type="text/javascript" src="jQueryRotate.js"></script>

Also the closing tags for the script tag should be </script>

<html>
    <head>
        <title>Rotate Image</title>
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript" src="jQueryRotate.js"></script>
    </head>
    <body>
        <script type="text/javascript">
            $(document).ready(function(){
                $("#image").rotate({ 
                   bind: 
                     { 
                        click: function(){
                            $(this).rotate({ angle:0,animateTo:180,easing: $.easing.easeInOutExpo })
                        }
                     } 

                });
            });
        </script>   
        <img src="http://placehold.it/64" id="image"/> 
    </body>
</html>

Upvotes: 1

Related Questions