<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>拖曳排序插件</title>
<script src="http://www.imooc.com/data/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="http://www.imooc.com/data/jquery-ui-1.9.2.min.js" type="text/javascript"></script>
<style>
#divtest{width: 282px;}
#divtest .title{
padding: 8px;
background-color:Blue;
color:#fff;
height: 23px;
line-height: 23px;
font-size: 15px;
font-weight: bold;
}
.fl{float: left;}
.fr{float: right;}
ol{
float: left;
width: 280px;
padding: 5px 40px;
margin: 0px;
font-size: 14px;
}
ol li{
float: left;
width: 200px;
height: 32px;
line-height: 32px;
padding: 3px 8px;
border:solid 1px #ccc;
background-color:#eee;
cursor:move;
margin:2px 0px;
}
</style>
</head>
<body>
<div id="divtest">
<div class="title">
<span class="fl">我最喜欢的运动</span>
</div>
<div class="content">
<ol>
<li>足球</li>
<li>散步</li>
<li>篮球</li>
<li>乒乓球</li>
<li>骑自行车</li>
</ul></div>
</div>
<script type="text/javascript">
$(function () {
$("ol").sortable({
delay:2,
opacity:0.4
})
});
</script>
</body>
</html>我把无序列表改成了有序列表,拖动之后可以有新排名,好看多了o(∩_∩)o