jquery拖動(dòng)插件(jquery.drag)使用介紹
更新時(shí)間:2013年06月18日 17:44:51 作者:
可以使用鼠標(biāo)任意拖動(dòng)列表項(xiàng)改變默認(rèn)的位置,具體的實(shí)現(xiàn)如下(附演示),感興趣的朋友可以學(xué)習(xí)下
復(fù)制代碼 代碼如下:
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>jQuery Dynamic Drag'n Drop</title>
<script type="text/javascript" src="http://www.webresourcesdepot.com/wp-content/uploads/file/jquerydragdrop/jquery-1.3.2.min.js"></script><style type="text/css"></style>
<script type="text/javascript" src="http://www.webresourcesdepot.com/wp-content/uploads/file/jquerydragdrop/jquery-ui-1.7.1.custom.min.js"></script>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
margin-top: 10px;
}
ul {
margin: 0;
}
#contentWrap {
width: 700px;
margin: 0 auto;
height: auto;
overflow: hidden;
}
#contentTop {
width: 600px;
padding: 10px;
margin-left: 30px;
}
#contentLeft {
float: left;
width: 400px;
}
#contentLeft li {
list-style: none;
margin: 0 0 4px 0;
padding: 10px;
background-color:#00CCCC;
border: #CCCCCC solid 1px;
color:#fff;
}
#contentRight {
float: right;
width: 260px;
padding:10px;
background-color:#336600;
color:#FFFFFF;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$(function() {
$("#contentLeft ul").sortable({ opacity: 0.5, cursor: 'move', update: function() {
var id="";
$("ul.ui-sortable li").each(function(){
id+=$(this).attr("id")+"<br/>";
})
$("#contentRight").html(id);
}
});
});
});
</script>
</head>
<body style="cursor: auto;">
<div id="contentWrap">
<div id="contentLeft">
<ul class="ui-sortable">
<li id="recordsArray_3" style="opacity: 1; z-index: 0;" class="">3. Returned array can be found at the right</li>
<li id="recordsArray_2">2. Dragging changes the opacity of the item</li>
<li id="recordsArray_1" style="opacity: 1; z-index: 0;" class="">1. Once dropped, an Ajax query is activated</li>
<li id="recordsArray_4" style="opacity: 1; z-index: 0;" class="">4. It is very very easy</li>
<li id="recordsArray_5" style="opacity: 1; z-index: 0;" class="">5. It is very very easy</li>
<li id="recordsArray_6" style="opacity: 1; z-index: 0;" class="">6. It is very very easy</li>
<li id="recordsArray_7" style="opacity: 1; z-index: 0;" class="">7. It is very very easy</li>
</ul>
</div>
<div id="contentRight"></div>
</div>
</body></html>
demo地址
您可能感興趣的文章:
- PHP+MySQL+jQuery隨意拖動(dòng)層并即時(shí)保存拖動(dòng)位置實(shí)例講解
- PHP+jQuery實(shí)現(xiàn)隨意拖動(dòng)層并即時(shí)保存拖動(dòng)位置
- jQuery 拖動(dòng)層(在可視區(qū)域范圍內(nèi))
- 使用jQuery的easydrag插件實(shí)現(xiàn)可拖動(dòng)的DIV彈出框
- 輕松學(xué)習(xí)jQuery插件EasyUI EasyUI實(shí)現(xiàn)拖動(dòng)基本操作
- jQuery插件slider實(shí)現(xiàn)拖動(dòng)滑塊選取價(jià)格范圍
- 基于jquery的拖動(dòng)布局插件
- jquery拖動(dòng)層效果插件用法實(shí)例分析(附demo源碼)
相關(guān)文章
EasyUI Pagination 分頁(yè)的兩種做法小結(jié)
這篇文章主要介紹了EasyUI Pagination 分頁(yè)的兩種做法小結(jié)的相關(guān)資料,需要的朋友可以參考下2016-07-07基于jquery.page.js實(shí)現(xiàn)分頁(yè)效果
這篇文章主要為大家詳細(xì)介紹了基于jquery.page.js實(shí)現(xiàn)的分頁(yè)效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-01-01使用CSS樣式position:fixed水平滾動(dòng)的方法
這篇文章主要介紹了使用CSS樣式position:fixed水平滾動(dòng)的方法,需要的朋友可以參考下2014-02-02jQuery實(shí)現(xiàn)的多張圖無(wú)縫滾動(dòng)效果【測(cè)試可用】
這篇文章主要介紹了jQuery實(shí)現(xiàn)的多張圖無(wú)縫滾動(dòng)效果,可實(shí)現(xiàn)自定義向左或向右滾動(dòng)的功能,涉及jQuery結(jié)合時(shí)間函數(shù)動(dòng)態(tài)操作頁(yè)面元素屬性的相關(guān)技巧,需要的朋友可以參考下2016-09-09jquery讓返回的內(nèi)容顯示在特定div里(代碼少而精悍)
之前寫(xiě)過(guò)ajax讓返回的內(nèi)容顯示在特定div里最近在看jquery,所以又用jquery重新寫(xiě)了個(gè),需要的朋友可以參考下2014-06-06基于jquery實(shí)現(xiàn)的一個(gè)選擇中國(guó)大學(xué)的彈框 (數(shù)據(jù)、步驟、代碼)
基于jquery實(shí)現(xiàn)的一個(gè)選擇中國(guó)大學(xué)的彈框,需要的朋友可以參考下2012-07-07js過(guò)濾HTML標(biāo)簽以及空格的思路及代碼
今天要做一個(gè)應(yīng)用--判斷編輯器中文字的個(gè)數(shù)。如果少如20個(gè)字就不能讓其提交。沒(méi)多想,正好周末的時(shí)候看了一下js中正則表達(dá)式的內(nèi)容。很容易就想到了要用正則表達(dá)式來(lái)解決這個(gè)問(wèn)題。雖說(shuō)看了正則表達(dá)式的內(nèi)容是看了,但是畢竟還是剛接接觸,連基本的概念都很模糊,于是只好在網(wǎng)上找到如下的代碼:2013-05-05