How do you rotate an image using jQuery-rotate plugin?
I have tried the following and it doesn\'t seem to work:
Your logic for rotating the image is right. It will work if executed when the document is ready.
<script type="text/javascript">
//<![CDATA[
var angle = 1;
$(document).ready(function() {
setInterval(function() {
$("#pic").rotate(angle);
/* angle += 1; Increases the rotating speed */
}, 100);
});
//]]>
</script>
You've got a 404 on jQuery and the jQuery plugin. Because of that, your page is throwing a JavaScript error, that $ is not defined.
You need to learn basic JavaScript debugging techniques. A quick search found this article that looks like a good place for you to start:
Once you fix your jquery include issues, you can fix your script. Your syntax is wrong: Here is the fix:
<script type="text/javascript">
//<![CDATA[
var angle = 1;
$(document).ready(function(angle) {
setInterval(function(angle) {
$("#pic").rotate(angle);
/* angle += 1; Increases the rotating speed */
}, 100);
});
//]]>
</script>