jquery sortable cannot be dragged outside of accordion

前端 未结 3 1312
刺人心
刺人心 2021-01-24 18:23

I have 2 connected sortable lists. One is inside an accordion. When I try to drag items from the sortable in the accordion, the helper disappears as soon as I get outside of t

3条回答
  •  暖寄归人
    2021-01-24 18:49

    I'm a little late, I know, but I had a similar problem with two sortable accordions where you can drag&drop items between the two accordions.

    So, for future reference:

    I also couldn't get the accordion-items to "go out" of the source-accordion, and google led me to this question.

    I solved my problem by adding axis: undefined on the sortable() function:

            $("#accordion1")
            .accordion({
                collapsible: true,
                header: "> div > h3",
                dropOnEmpty: true,
                autoHeight: false,
                active: false
            })
            .sortable({
                axis: "y",
                handle: "h3",
                stop: function() {
                    stop1 = true;
                },
                connectWith: '.connectedSortable',
                helper: 'clone',
                axis: undefined
            });
    

    Now the accordion-items can be dragged all over the place.

提交回复
热议问题