How to make jQuery draggable with fixed X and Y axis?

前端 未结 5 840
花落未央
花落未央 2020-12-30 09:22

I am wondering if there is a way to make the jQuery draggable to only drag straight up, down and left, right. I want to prevent the user from dragging a div diagonally. Usin

5条回答
  •  执笔经年
    2020-12-30 10:01

    I'm posting this answer after much fiddling to say that it's not possible with just jqueryui calls on the object. It seems that it will not allow you to change the restraint axis while you are already dragging.

    Please prove me wrong?

提交回复
热议问题