/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* <div id="rleft"> <p>etc</p> <p>etc</p> <p>etc</p> </div> */ $("#rleft").sortable({ axis: 'y', items: "p", start: startdrag, stop: stopdrag, }) function startdrag(event, ui){ var old_position = $("#rleft p").index(ui.item) ui.item.data("old", old_position) } function stopdrag(event, ui){ var new_position = $("#rleft p").index(ui.item) ui.item.data("new", new_position) var old_position = ui.item.data("old") var change = new_position - old_position var moved_up = change > 0 }