ByulTaeng
ByulTaeng

Reputation: 1269

How to mimic Wordpress "Widget" drag & drop behavior?

I need to mimic Wordpress "Widget" drag & drop behavior. jQuery UI Sortable can do it but not the same way as WP.

I can drag & drop now but the dropped element is removed from the source. That's not what I expected.

Let's say I have two <ul> A and B. I drag an item of A and drop it to B and I expect the item stay within A, not to be removed from it.

Any idea? I really appreciate your helps!

Upvotes: 1

Views: 3497

Answers (1)

RDL
RDL

Reputation: 7961

Check out the jQuery Draggable Sortable demo

If you want the draggable item to remain in the first list as well look you need to set 'helper' to 'clone'

ie.

$( "#draggable" ).draggable({
  connectToSortable: "#sortable",
  helper: "clone",
  revert: "invalid"
});

Upvotes: 2

Related Questions