jquery ui draggable and sortable

Add the following jquery code to the Jquery ui plugin.


jQuery(document).ready(function($) {
 $( ".sortable" ).sortable({
      revert: true
    });
    $( ".draggable" ).draggable({
      connectToSortable: ".sortable",
      helper: "clone",
      revert: "invalid"
    });
    $( "ul, li" ).disableSelection();
});

Then use an unordered list with the same classes to call the jquery.

  • Drag me down
  • Item 1
  • Item 2
  • Item 3
  • Item 4
  • Item 5
Print Friendly

Leave a Reply

Your email address will not be published. Required fields are marked *



*