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>
2.Attach the sortable class to the element
<tbody class="sortable"> <tr></tr> <tr></tr> </tbody>
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(); });
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!