assaqqaf
assaqqaf

Reputation: 1585

in jquery dragable, with revert the item doesn't return to it's start position

I use jquery-ui dragable and set revert option to invalid.

the problem is when i drag an item and drop it an invalid position it doesn't return to its start position. it take place in new position.

I include the example:

http://jsfiddle.net/zMxJv/

Upvotes: 3

Views: 559

Answers (2)

tbleckert
tbleckert

Reputation: 3803

First of all the option revert takes the values true and false only, invalid and valid is available on droppable, you're using draggable.

To solve your problem there is two options, both using sortable and last one also droppable. First one is with the option:

containment: 'parent'

That will not even allow you to drag an element outside the container.

The other option requires more code. Check this out: http://jsfiddle.net/qMdGs/3/

UPDATE: http://jsfiddle.net/qMdGs/5/

Upvotes: 3

mgoeppner
mgoeppner

Reputation: 151

Remove the draggables and the droppable from the code -- you don't actually need them since sortable handles that for you.

Here's an updated fiddle to give you an idea of where this heads: http://jsfiddle.net/zMxJv/5/

If you only want each individual day sortable without cross pollination from other days, remove the connectWith property.

Upvotes: 1

Related Questions