简体   繁体   中英

Jquery ui sortable doesn't swap properly

Not sure why it doesn't swap properly. I did a demo in https://jsfiddle.net/33keyjxx/ to show the problem.

$(".draggable-portlets .sorted" ).sortable({
                    connectWith: ".draggable-portlets .sorted",
                    handle: '.panel-heading',
                    start: function()
                    {
                        $draggable_portlets.addClass('dragging');
                    },
                    stop: function()
                    {
                        $draggable_portlets.removeClass('dragging');
                    }
                });

Any thought on this?

You could checkout my solution . The root cause here seems to be that the ui-sortable class must be the wrapper of all sortable items, not one of them.

<div class="ui-sortable">
  <div class="panel"></div>
  <div class="panel"></div>
  <div class="panel"></div>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM