我已经下载了 1.11.3.min.js 文件并将其放在保存 HTML 和脚本文件的同一文件中。在编写这段代码之前,我已经练习了很多 jQuery,那次我成功了,但这次我无法运行它。
HTML
<!DOCTYPE html>
<head>
<!---<script type="text/javascript" src="image.js"></script---->
<script src="jquery-1.11.3.min.js"></script>
<script src="jquery.js"></script>
<!---<link rel="stylesheet" type="text/css" href="image.css">---->
</head>
<body onload="slideimage()">
<img src="1.jpg" id="slide" width="400px" height="400px"/>
<div id="button">
`enter code here`<button onclick="change_image()" />1</button>
</div>
</body>
</html>
jQuery
$document.ready(function(){
$("#slide").click(function(){
$(this).slideUp(400);
});
});
我已经下载了 1.11.3.min.js 文件,并将其放入保存 HTML 和脚本文件的同一个文件中。在编写这段代码之前,我已经练习了很多 jQuery,并且那些时候我已经成功了。但是这个时间我无法运行它。
最佳答案
只需替换这行代码即可
$document.ready(function(){
用这一行
$(document).ready(function(){
您没有在文档
两边添加括号
关于javascript - 无法使用 jQuery 滑动 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34255303/