How do I get position x and y from jQuery ui draggable?

前端 未结 4 2230
灰色年华
灰色年华 2020-12-30 17:04

Here an example http://jsfiddle.net/naqbq/

How do I grab current position for x and y after re-position the image?



        
4条回答
  •  时光说笑
    2020-12-30 17:19

    You can use jQuery's .offset().

    http://api.jquery.com/offset/

    alert($('#image').offset().top);
    alert($('#image').offset().left);
    

提交回复
热议问题