行排序2

<!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>
    <link href="js/jquery-ui-1.12.1/jquery-ui.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table  id="sort" class="table">
    <thead class="table-header">
      <tr>
        <td class="index" style="width: 20px;">序号</td>
         <td style="width: 150px;">缩略图</td>
         <td style="width: 500px;">图片介绍</td>
     </tr>
   </thead>
   <tbody class="table-body">
     <tr class=" drag"  >
        <td  class="index"></td>
         <td>
             <img src="" width="100px"
                  height="100px">
         </td>
         <td>
              <input type="text" ng-model="foo.content" maxlength="200"
                        style="width: 100%"/>
         </td>
      </tr>
           <tr class=" drag"  >
        <td  class="index"></td>
         <td>
             <img src="" width="100px"
                  height="100px">
         </td>
         <td>
              <input type="text" ng-model="foo.content" maxlength="200"
                        style="width: 100%"/>
         </td>
      </tr>
    </tbody>

</table>   
     <script src="js/jquery-ui-1.12.1/external/jquery/jquery.js" type="text/javascript"></script>
    <script src="js/jquery-ui-1.12.1/jquery-ui.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () { sortable(); });
        function sortable() {
            var fixHelperModified = function (e, tr) {
                var $originals = tr.children();
                var $helper = tr.clone();
                $helper.children().each(function (index) {
                    $(this).width($originals.eq(index).width())
                });
                return $helper;
            },
          updateIndex = function (e, ui) {
              $('td.index', ui.item.parent()).each(function (i) {
                  $(this).html(i + 1);
              });
          };
            $("#sort tbody").sortable({
                cursor: "move",
                items: "tr", //只是tr可以拖动
                opacity: 0.6, //拖动时,透明度为0.6
                helper: fixHelperModified,
                stop: updateIndex
            }).disableSelection();
        }
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值