Need to limit draggable to BOTH x and y axis (no diagonal movement)

Need to limit draggable to BOTH x and y axis (no diagonal movement)


I only started with jquery a couple days ago so if if I'm using the
wrong terms anywhere I apologize in advance.
I need to limit a draggable to both the x and y axis inside a larger
parent element. It has to be just up or down or left or right -
nothing diagonal. Searching the web and this group came up with no
solutions.
Is there a way to handle this now? Putting in both x and y in the axis
field doesn't work. My only idea at this point is to is to have some
kind of test where if x changes first then I have the axis set to x,
and if y changes first limit the axis to y. And would I need to have
it tied to something else like a mousedown start the whole thing?