[draggable] Update containment while dragging

[draggable] Update containment while dragging

I try to describe my problem as simple as possible:

I do have two bars, both at the same distance from top and both horizontally moveable. Since both have a fixed containment they might overlap while dragging. How could I prevent this? I couldn't find a way to re-calculate the containment without a display error ( the bar suddenly disappears ).

Any suggestions from the pros?