开发者

jQuery/JavaScript: Reorder Unordered List via Dragging

开发者 https://www.devze.com 2023-01-09 07:05 出处:网络
I have an unordered list <ul> with list items <li> which I\'d like to be able to \"reorder\" via dragging. I\'m using jQuery. How could I accomplis开发者_JS百科h this? I tried hooking into

I have an unordered list <ul> with list items <li> which I'd like to be able to "reorder" via dragging. I'm using jQuery. How could I accomplis开发者_JS百科h this? I tried hooking into the click event but I can't get the drag to work right (I want the other <li> elements to move out of the way once I drag an <li> element over a suitable spot so the user can see where it would end up).

Help?


If you don't need to invent the wheel:

http://jqueryui.com/demos/sortable


Have you considered jQuery UI's droppable/draggable functionality?

Here's a link to a ul demo.

http://jqueryui.com/demos/draggable/#sortable

0

精彩评论

暂无评论...
验证码 换一张
取 消