Home > Web Front-end > HTML Tutorial > How to implement HTML table mouse drag sorting

How to implement HTML table mouse drag sorting

php中世界最好的语言
Release: 2018-01-18 09:58:38
Original
3119 people have browsed it

This time I will show you how to implement table mouse drag sorting in HTML. What are the precautions for using HTML to implement table mouse drag sorting? Here is a practical case, let’s take a look.

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.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

I believe you have mastered the method after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

How to use the img tag of HTML images

What are the name, id and class in HTML? What's the difference

#How to use HTML+CSS to display the secondary menu bar by swiping the mouse over it

The above is the detailed content of How to implement HTML table mouse drag sorting. For more information, please follow other related articles on 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