工作中需要將一個(gè)左邊的設(shè)計(jì)好的控件,拖拽到右邊的面板中,同時(shí)保持右邊面板中的控件自由排序,這時(shí)候就需要及支持拖拽又支持排序的操作了,
成都創(chuàng)新互聯(lián)公司長期為千余家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為陳倉企業(yè)提供專業(yè)的成都做網(wǎng)站、網(wǎng)站制作,陳倉網(wǎng)站改版等技術(shù)服務(wù)。擁有十年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。
Demo截圖:從左邊控件拖到右邊區(qū)域
代碼段:
<script type="text/javascript"> $(function () { $("#box_wrap1,#box_wrap2").sortable({ connectWith: ".box_wrap", helper: "clone", cursor: "move",//移動(dòng)時(shí)候鼠標(biāo)樣式 opacity: 0.5, //拖拽過程中透明度 placeholder: "box-holdplace",//占位符className,設(shè)置一個(gè)樣式 }).disableSelection(); $(".dragable").draggable({ connectToSortable: ".sortable", helper: "clone", // revert: "invalid", // handle: ".handle" }); }); </script>
Html 代碼:
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <link href="js/bootstrap/css/bootstrap.css" rel="external nofollow" rel="stylesheet" /> <link href="js/bootstrap/css/bootstrap-theme.min.css" rel="external nofollow" rel="stylesheet" /> <link href="css/index.css" rel="external nofollow" rel="stylesheet" /> <script src="js/jquery-1.10.2.min.js"></script> <script src="js/bootstrap/js/bootstrap.min.js"></script> <!--Sortable --> <script src="http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> </head> <body> <div class="container"> <div class="row"> <div class="column col-md-6"> <div class="box_wrap " id="box_wrap1" > <div class="box dragable"> left-test1 </div> <div class="box dragable"> left-test2 </div> <div class="box dragable"> left-test3 </div> </div> </div> <div class="column col-md-6"> <div class="box_wrap sortable" id="box_wrap2"> <div class="box"> test1 </div> <div class="box"> test2 </div> <div class="box"> test3 </div> </div> </div> </div> </div> </body> </html>
以上這篇jQuery UI Draggable + Sortable 結(jié)合使用(實(shí)例講解)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持創(chuàng)新互聯(lián)。
當(dāng)前名稱:jQueryUIDraggable+Sortable結(jié)合使用(實(shí)例講解)
網(wǎng)站路徑:http://aaarwkj.com/article0/jeseio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、小程序開發(fā)、移動(dòng)網(wǎng)站建設(shè)、商城網(wǎng)站、定制開發(fā)、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)