jQuery没有在我的网站上工作?

use*_*739 0 html javascript css jquery

我尝试在我的网站上使用jQuery,但它似乎没有用.我认为我做错了什么,所以我尝试将我完成的codecademy课程复制到测试网站上.这是代码:

HTML

<!DOCTYPE html>
<html>
    <head>
        <title>Test Codecademy Lesson</title>
        <link rel='stylesheet' type='text/css' href='stylesheet.css'/>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script type='text/javascript' src='script.js'></script>
    </head>
    <body>
        <img src="http://i1061.photobucket.com/albums/t480/ericqweinstein/elevator.png"/>   
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

CSS

body {
    margin: 0;
    padding: 0;
}
img {
position: absolute;
}
Run Code Online (Sandbox Code Playgroud)

使用Javascript/jQuery的

$(document).ready(function() {
    $('img').animate({top:'+=100px'},1000)
});
Run Code Online (Sandbox Code Playgroud)


有人能告诉我为什么这段代码不起作用?我的浏览器是Chrome,我有最新版本.

Din*_*ivu 6

您需要下载jquery库并保存本地文件您可以从中下载它

http://jqueryui.com/

要么

你必须使用这个链接

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
Run Code Online (Sandbox Code Playgroud)

或者缩小版

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
Run Code Online (Sandbox Code Playgroud)

http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js - 版本1.9.1系列,Google托管

你也可以参考一下

是否有链接到Google API上的"最新"jQuery库?