如何使用 jQuery UI Resizable 仅水平或垂直调整大小?

问题描述:

我发现的唯一解决方案是使用当前值设置最大和最小高度或宽度.

The only solution I've found is to set the max and min height or width with the current value.

示例:

foo.resizable({ 
  maxHeight: foo.height(), 
  minHeight: foo.height() 
});

但这真的很难看,特别是如果我必须以编程方式更改元素的高度.

But this is really ugly, especially if I have to change the element's height programmatically.

您可以设置调整大小 handles 选项 只显示在左右(或东/西),像这样:

You could set the resize handles option to only show on the left and right (or east/west), like this:

foo.resizable({
    handles: 'e, w'
});​

你可以在这里试一试.