dynamically detect when children are at the edge and move them