Howto rotate image using jquery rotate plugin?

好久不见. 提交于 2019-11-30 04:12:06
mqsoh

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:

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>
Spencer

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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!