【发布时间】:2016-08-22 08:37:37
【问题描述】:
我正在处理我的项目,不得不使用 .draggable()。我无法让它发挥作用,我不知道出了什么问题,所以我决定从 Codeacademy 复制这个练习,看看它是否有效。它也没有用。
我的 HTML:
<!DOCTYPE html>
<html>
<head>
<title>Game Test</title>
<link rel='stylesheet' type='text/css' href='art.css' />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div id="stayaway"></div>
</body>
</html>
我的 CSS:
#stayaway {
width: 80px;
height: 80px;
background-color: blue;
position:relative;
}
我的 JS:
$(document).ready(function(){
$("#stayaway").draggable();
});
这只是一个基本功能。我不知道这里有什么问题。其他功能,如 fadeOut 正在工作。
【问题讨论】:
标签: javascript jquery jquery-ui draggable jquery-ui-draggable