2

I have two sortables connected by means of jQuery sortable plugin. Is it possible to change target for draggables for one of them? I want to drag not from #sortable1 to #sortable2, but to $('#sortable').parent(), because #sortable2 is too small. Making it larger spoils html layout.

$( "#sortable1, #sortable2" ).sortable({
  connectWith: ".connectedSortable"
}).disableSelection();

<ul id="sortable2" class="connectedSortable">
  <li class="ui-state-default">Item 1</li>
  <li class="ui-state-default">Item 2</li>
</ul>

<ul id="sortable2" class="connectedSortable">
  <li class="ui-state-default">Item 3</li>
</ul>

Here is a demo: https://jsfiddle.net/uq3vu5ne/

Stepan Yakovenko
  • 8,670
  • 28
  • 113
  • 206

1 Answers1

0

I am not sure I understand what you are trying to achieve here. You want your parent div to get the height of your second sortable or your sortables to have a fixed height?

If it's the first you can remove the static height. If it's the latter you can add fixed height and scroll to your sortables.

UPDATE: I think you need sortable/droppable take a look at this post please.

jQuery Sortable and Droppable

Community
  • 1
  • 1
codegaze
  • 755
  • 7
  • 15
  • i want to be able to drag not to sortable2, but to its parent area. it should be highlighted and recieve dragged object as if it was sortable2 – Stepan Yakovenko Aug 17 '15 at 09:36