JQuery-UI draggable reset to original position

后端 未结 6 1921
自闭症患者
自闭症患者 2020-12-18 22:28

This is probably very easy to do, but I always think too complicated.

I\'ve just set up a simple test with #draggable / #droppable with a fixed width/height + float:

6条回答
  •  旧时难觅i
    2020-12-18 22:57

    I used h0dges' basic idea. The balls I created returned to their original positions, but I lost the styles that made them into balls. Therefore, I kept the styles of the balls and just reset their top and left styles to return them to their original positions:

    function endRound() {
       $(".ball").css({"top":"", "left":""});
    }
    

提交回复
热议问题