我尝试在我的网站上使用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,我有最新版本.