更新时间:2023-12-04 10:30:58
我分叉了您的plunkr,并弄乱了它.我认为它可以按照您现在想要的方式工作.
I forked your plunkr and messed around with it. I think it works the way you want now.
http://plnkr.co/edit/1y8jE0SLuJK6XTNRBKF3?p=preview
主要解决的问题是按其索引对dom元素列表进行排序,然后将$ index添加到该元素的数据索引attr.
Mainly what fixed it was sorting the list of dom elements by their index, and to do that I added the $index to a data-index attr on the element.