Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery UI Examples - Resizable (Resizable)

jQuery UI Examples - Resizable (Resizable)

Change the size of an element using the mouse.

For more details about the resizable interaction, see the API documentation Resizable Widget。

Default functionality

Enable resizable functionality on any DOM element. Drag the right or bottom border with the mouse to the desired width or height.









  

  jQuery UI 缩放(Resizable) - 默认功能

  

  

  

  

  

  





 

缩放(Resizable)

Animation

Use animate The option (boolean) animates the resizing behavior. When this option is set to true, drag the outline to the desired position and the element will animate to that size when the drag stops.









  

  jQuery UI 缩放(Resizable) - 动画

  

  

  

  

  

  





 

动画

Limit the resize area

Define the boundaries of the resize area. Use the containment option to specify a parent DOM element or a jQuery selector, such as 'document.'









  

  jQuery UI 缩放(Resizable) - 限制缩放区域

  

  

  

  

  

  





 

限制

缩放(Resizable)

Delayed start

Pass delay The option sets the delay in milliseconds before resizing starts. Use the distance option to require the cursor to be pressed and dragged a specified number of pixels before resizing is allowed.









  

  jQuery UI 缩放(Resizable) - 延迟开始

  

  

  

  

  

  





 

时间延迟 (ms):

时间

距离延迟 (px):

距离

Helper

By setting helper The option is a CSS class that shows only the element's outline while resizing.









  

  jQuery UI 缩放(Resizable) - 助手

  

  

  

  

  

  





 

助手

Maximum/minimum size

Use maxHeight、maxWidth、minHeight and minWidth The options limit the maximum or minimum height or width of the resizable element.









  

  jQuery UI 缩放(Resizable) - 最大/最小尺寸

  

  

  

  

  

  





 

放大/缩小

Maintain aspect ratio

Maintain the existing aspect ratio or set a new one to constrain the resize ratio. Set the aspectRatio option to true, and optionally pass a new ratio (for example, 4/3).









  

  jQuery UI 缩放(Resizable) - 保持纵横比

  

  

  

  

  

  





 

保持纵横比

Snap to grid

Snap the resizable element to a grid. Use the grid option to set the size of the grid cells (height and width in pixels).









  

  jQuery UI 缩放(Resizable) - 对齐到网格

  

  

  

  

  

  





 

网格

Synchronous resizing

Resize multiple elements simultaneously by clicking and dragging the edge of one element. Pass a alsoResize shared selector to the option.









  

  jQuery UI 缩放(Resizable) - 同步缩放

  

  

  

  

  

  





 

缩放

同步缩放

Text box

A resizable text box.









  

  jQuery UI 缩放(Resizable) - 文本框

  

  

  

  

  

  





 



 

 





Visual feedback

By setting ghost When the option is true, a semi-transparent element is shown during resizing instead of the actual element.









  

  jQuery UI 缩放(Resizable) - 视觉反馈

  

  

  

  

  

  





 

Ghost