tracking an object while dragged
hello community,
i am using a draggable object "regler" which works fine to drag on the
x axe (it's supposed to be like a volume control) but i want to put a
action on it whenever it gets moved. for this action the position
(distance to left edge) is needed.
i figured out how i can get the position whenever i click on the
object, the next step is to get the live position while it gets
dragged. can anyone help me with this?
your help is much appreciated!
thanks in advance
dirk
#HTML
<div id="crossfader">
<div id="regler"></div>
</div>
#JS
$(document).ready(function(){
$("#regler").draggable(
{
containment: 'parent', // only move in parent
object
axis: 'x',
});
$("#regler").mousedown(function() // should get fired whenever
it get
moved, not clicked
{
var position = $("#regler").position();
console.log( "left: " + position.left);
});
});