How to prevent draggable child elements from dragging over each other in absolute position?
Something like:
if( ($("#firstChild").position().left) >= ($("#secondChild").position().left) )
{
$(this).draggable({ disabled: true });
}
but this only disables dragabble when stop dragging, the goal is to prevent from overdragging in some way…Or with Droppable???
Any ideas for CASE 2?
EDIT:
Also, this is maximum for child1 towards child2 , so no overlap occurs, but child1 can push child2 on right, and child2 can push child1 on left, important thing is that no overlap ocurrs!
Some notes before / in order to reach the optimal solution:
allBetweenvariablw, but not using it. I suggest to remove it.#buttonOneevent listener, you’re using inconsistent values: 429 and 424:if($("#firstInput").val() > 429 )$("#firstInput").val(424);#firstInput(and#thirdInput) selector multiple times without caching a reference.Final code
The optimisations have been explained previously. I will not elaborate them, since that’s not the topic of the question. I have explained the function logic of the requested behavior in the scripts comments (below).