首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >jquery.rotate错误

jquery.rotate错误
EN

Stack Overflow用户
提问于 2012-07-19 22:39:54
回答 1查看 1.3K关注 0票数 2

我有一个图像,我正试图将它旋转30度,并在页面上水平移动。但是,我认为我没有正确处理jquery,因为我在Firefox Web控制台中收到了几个错误。以下是错误:

代码语言:javascript
复制
[10:30:27.260] ReferenceError: jQuery is not defined @ file:///home/ladmin/Desktop/javascriptAnimations/jquery.rotate.1-1.js:1
[10:30:27.274] The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol. @ file:///home/ladmin/Desktop/javascriptAnimations/si110cockroach.html
[10:31:03.416] ReferenceError: $ is not defined @ file:///home/ladmin/Desktop/javascriptAnimations/si110cockroach.html:12

我在顶部的jquery源代码中包含了脚本标记,如下所示:

代码语言:javascript
复制
<script language="javascript" type="text/javascript" src="jquery.rotate.1-1.js"></script>

下面是我调用jquery的代码:

代码语言:javascript
复制
function moveLeft(object,x,y){
        $(object).rotateRight(30);
        object.style.right = x + "px";
        object.style.top   = y + "px";

        if (x < 0 || x > 1500 || y < 0 || y > 1500)
        {
            object.style.visibility="hidden";
        }
        else
        {               
            var t = setTimeout(function() { moveLeft(object,x+3,y+0); }, 5);
        }
    }

我是不是没有正确地包含源文件,或者我没有正确地调用jquery?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-19 22:41:57

您必须在jquery.rotate.1-1.js脚本之前包含jquery.min.js

代码语言:javascript
复制
<script language="javascript" type="text/javascript" src="jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="jquery.rotate.1-1.js"></script>
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11563238

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档