js: prevent draggable to stay in current window and not to overflow