国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jQueryUI Sortable 應用Demo(分享)

2019-11-19 15:31:34
字體:
來源:轉載
供稿:網友

最近工作用需要設計一個自由布局的頁面設計。我選了jQuery UI 的 sortable ,可以拖拽,自由排序 使用很方便,寫一個demo,做個記錄。

第一、單項目自由排序

下圖效果

代碼段:

<script type="text/javascript">    $(function () {    $("#box_wrap").sortable({      helper: "clone",      placeholder: "box-holdplace",      sort: function (e, ui) {        //排序時觸發事件      },      // handle: ".handle",//指定元素內的某種元素才可以拖動,非常有用    }).disableSelection();     });</script>

html:

<!DOCTYPE html><html><head>  <meta charset="utf-8" />  <title></title>  <link href="js/bootstrap/css/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="stylesheet" />  <link href="js/bootstrap/css/bootstrap-theme.min.css" rel="external nofollow" rel="external nofollow" rel="stylesheet" />  <link href="css/index.css" rel="external nofollow" 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="box_wrap" id="box_wrap">    <div class="box">      test1    </div>    <div class="box">      test2    </div>    <div class="box">test3    </div>  </div></body></html>

第二、多排序組之間自由拖拽

代碼段:

<script type="text/javascript">      $(function () {    $("#box_wrap1,#box_wrap2").sortable({      connectWith: ".box_wrap",      helper: "clone",      cursor: "move",//移動時候鼠標樣式          opacity: 0.5, //拖拽過程中透明度      placeholder: "box-holdplace",//占位符className,設置一個樣式        }).disableSelection();  });</script>

html 代碼:

<!DOCTYPE html><html><head>  <meta charset="utf-8" />  <title></title>  <link href="js/bootstrap/css/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="stylesheet" />  <link href="js/bootstrap/css/bootstrap-theme.min.css" rel="external nofollow" rel="external nofollow" rel="stylesheet" />  <link href="css/index.css" rel="external nofollow" 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">            left-test1          </div>          <div class="box">            left-test2          </div>          <div class="box">            left-test3          </div>        </div>      </div>      <div class="column col-md-6">        <div class="box_wrap" id="box_wrap2" >          <div class="box">            test1          </div>          <div class="box">            test2          </div>          <div class="box">            test3          </div>        </div>      </div>    </div>     </div></body></html>

上面另種是工作中比較常用的排序形式。

以上這篇jQueryUI Sortable 應用Demo(分享)就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 紫云| 黄浦区| 海口市| 赫章县| 吉安市| 合作市| 平邑县| 兴义市| 揭东县| 迁安市| 阿拉尔市| 东乌珠穆沁旗| 灵宝市| 吐鲁番市| 石台县| 洛南县| 胶南市| 乌什县| 华宁县| 湘乡市| 安徽省| 丰宁| 米脂县| 新昌县| 克山县| 常德市| 定陶县| 唐山市| 潞西市| 肇州县| 堆龙德庆县| 静宁县| 中卫市| 许昌县| 仙桃市| 易门县| 遂昌县| 嘉义县| 永顺县| 曲靖市| 抚顺市|