How do I get the coordinate position after using jQuery drag and drop?

前端 未结 9 1346
北荒
北荒 2020-11-29 20:36

How do I get the coordinate position after using jQuery drag and drop? I want to save the coordinate to a database, so that next time I visit, the item will be in that posi

9条回答
  •  抹茶落季
    2020-11-29 20:54

    This worked for me:

    $("#element1").droppable(
    {
        drop: function(event, ui)
        {
            var currentPos = ui.helper.position();
                alert("left="+parseInt(currentPos.left)+" top="+parseInt(currentPos.top));
        }
    });
    

提交回复
热议问题