gpt4 book ai didi

javascript - jquery.rotate 错误

转载 作者:行者123 更新时间:2023-11-29 17:22:45 24 4
gpt4 key购买 nike

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

[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 源代码的脚本标签,如下所示:

<script language="javascript" type="text/javascript" src="jquery.rotate.1-1.js"></script>

这里是我调用 jquery 的代码:

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?

最佳答案

您必须包括 jquery.min.jsjquery.rotate.1-1.js 脚本之前:

<script language="javascript" type="text/javascript" src="jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="jquery.rotate.1-1.js"></script>

关于javascript - jquery.rotate 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11563238/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com