javascript - Changing DOM order after drag and drop with packey and draggabilly -
There is a bug on this code When I drag the "first" item to "last", the DOM does not change and the error appears in the console. Any thoughts? I'm really struggling to find the error. I appreciate all your help using the sample:
docReady (function (); On top pckry = new packery (slidesElem, {rowHyight: slideSize.outerHeight}); / varSelector ('slide.'); SlideSize = getSize (document.querySelector ('Slide.')); / Item items on itemElems = pckry.getItemElements (); // for each item (for example, I = 0 lane = itemElems.length; I & lt; lane; i ++) {var = ItemElems [i]; // Elements Draggabilly draggie with draggie to make = Draggabilly (ELEM, {axis: 'y'}); // Packery pckry.bindDraggabillyEvents (draggie) bound to draggabilly events;} // Once again the item is in the position after the dom pckry.on ('dragItemPositioned', function (_pckry, draggedItem) {var index = pckry.items.indexOf (draggedItem); nextItem = pckry.items [index + 1] ; SlidesElem.inser first (dragged itam.lim, next etam.liment);});});
You do not need to change the index, it should be just
on nextItem = pckry.items [index];
dragged item
returns to the index where you put it / where the next item
Comments
Post a Comment