效果圖:
1.引入文件
<script src="js/jquery-1.10.1.min.js"></script> <link rel="stylesheet" href="Public/css/jquery-ui.min.css"> <script src="js/jquery-ui.min.js"></script>
2.給元素附上sortable類
<tbody class="sortable"> <tr></tr> <tr></tr> </tbody>
3.開啟并配置
$(function() { $(".sortable").sortable({ cursor: "move", items: "tr", //只是tr可以拖動(dòng) opacity: 0.6, //拖動(dòng)時(shí),透明度為0.6 revert: true, //釋放時(shí),增加動(dòng)畫 update: function(event, ui) { //更新排序之后 var categoryids = $(this).sortable("toArray"); var $this = $(this); } }); $(".sortable").disableSelection(); });
以上所述是小編給大家介紹的HTML table鼠標(biāo)拖拽排序功能,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)網(wǎng)站的支持!
【網(wǎng)站聲明】本站除付費(fèi)源碼經(jīng)過測(cè)試外,其他素材未做測(cè)試,不保證完整性,網(wǎng)站上部分源碼僅限學(xué)習(xí)交流,請(qǐng)勿用于商業(yè)用途。如損害你的權(quán)益請(qǐng)聯(lián)系客服QQ:2655101040 給予處理,謝謝支持。