I am looking to reposition my #timebase1 div within the draghere div. Currently, it only moves the start of the div, but I would like to be able to drop it anywhere inside the draghere div.
function handleDrag(e) {
var id = e.id;
getMousePosition(id);
}
function getMousePosition(id) {
var x = event.pageX,
y = event.pageY
$('#' + id).css({
top: y,
left: x + ''
});
}
.activelevel1 {
background-color: #EA623E;
}
.timescalebase {
margin-top: 13px;
height: 7px;
position: relative;
width:0px;
}
<div id="draghere" style="width:100%; margin-top:25px;">
<div id="timebase1" draggable="true" class="timescalebase activelevel1" ondrag=handleDrag(this)>
</div>