Home > Web Front-end > HTML Tutorial > HTML table mouse drag and drop sorting function

HTML table mouse drag and drop sorting function

高洛峰
Release: 2017-02-13 13:56:41
Original
1353 people have browsed it

This article mainly introduces relevant information about the mouse drag and drop sorting function of HTML table. Friends who need it can refer to the

renderings:

HTML table鼠标拖拽排序功能

HTML table鼠标拖拽排序功能

1.Introduce the file

<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>
Copy after login

2.Give Attach the sortable class to the element

<tbody class="sortable">  
   <tr></tr>  
   <tr></tr>   
</tbody>
Copy after login

3. Open and configure

$(function() {  
    $(".sortable").sortable({  
        cursor: "move",  
        items: "tr", //只是tr可以拖动  
        opacity: 0.6, //拖动时,透明度为0.6  
        revert: true, //释放时,增加动画  
        update: function(event, ui) { //更新排序之后  
            var categoryids = $(this).sortable("toArray");  
            var $this = $(this);  
        }  
    });  
    $(".sortable").disableSelection();  
});
Copy after login

The above is the HTML table mouse drag and drop sorting function introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank you all for your support of the PHP Chinese website!

For more articles related to the HTML table mouse drag and drop sorting function, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template