problem with position of draggable object
hello,
i have a parent and a child div in it.
i just want to use a function whenever my child div is dragged, i get
the position of it (relative to the parent div). so if the child is on
the left edge it should be 0 but in my case i get the whitespace of
the browser added to it. so it's not the position related to it's
parent object.
what am i doing wrong?
thanks in advance!
here the code:
#HTML
<div id="parent">
<div id="child"></div>
</div>
#JS
drag: function() // while object is dragged, do this:
{
var width = $("#parent").width(); // parent's width
var position = $("#child").position(); // position of child is
related to whole document, not to parent object :(
}