Jquery animation doesn't work properly with the list items

后端 未结 1 1317
孤街浪徒
孤街浪徒 2021-01-29 10:02

I have a vertical list of items each with a delete button. When I click delete on one I want the ones beneath to slide up smoothly, at the moment they are jumping.

Here

1条回答
  •  别那么骄傲
    2021-01-29 10:36

    Actually im not sure if you can do this using li because the elements are not actually animating , they are just being resorted , which means nothing like margin , position or padding is changing , but i think you can achieve the desired effect if you use divs , a plugin like shapeshift may help you as well.

    http://mcpants.github.io/jquery.shapeshift/

    Edit:

    this is a quick solution i thought of , so hope it helps .

    Hint:

    you can remove the element after animation is over via .remove()

    http://fiddle.jshell.net/prollygeek/8zs3L/1/

    0 讨论(0)
提交回复
热议问题