jQuery offset combined with jQuery UI doesn't update on drag

Posted by Constructor on Stack Overflow See other posts from Stack Overflow or by Constructor
Published on 2010-04-12T14:58:30Z Indexed on 2010/04/12 15:03 UTC
Read the original article Hit count: 177

Filed under:
|
|
|
|

I need to get the offset of the element that is being dragged and I use:

$(function(){
    $(".draggable").draggable({
        stop: function(){
            var offset = $("#boxone").offset();
            alert(offset.left);
        }
    });
});

the element is positioned absolute and has a CSS of:

left:100px; 

that is the value I get on the alert when I drag the element (even multiple times).

What I want is to get it to alert the current offset (if I drag in 200px to the right it should say 300)

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ui