Resize
Allows you to resize an element.
new resize(resizeOptions);Basic implementation
Section titled “Basic implementation”const square = new resize({ element: '.square' });resizeOptions
Section titled “resizeOptions”interface ResizeOptions { element: string; edgeWidth?: number; onWidthChange?: (width: number) => void; onHeightChange?: (height: number) => void; widthMin?: number; widthMax?: number; heightMin?: number; heightMax?: number;}element
Section titled “element”Type:
type element = stringThe element selector.
edgeWidth
Section titled “edgeWidth”Type:
type edgeWidth = numberdefault: 5
The width of the edge that you can grab.
widthMin
Section titled “widthMin”Type:
type widthMin = numberdefault: 50
The minimum width that element can be resized to.
widthMax
Section titled “widthMax”Type:
type widthMax = numberdefault: window.innerWidth
The maximum width that element can be resized to.
heightMin
Section titled “heightMin”Type:
type heightMin = numberdefault: 50
The minimum height that element can be resized to.
heightMax
Section titled “heightMax”Type:
type heightMax = numberdefault: window.innerHeight
The maximum height that element can be resized to.
onWidthChange
Section titled “onWidthChange”Type:
type onWidthChange = (width: number) => void;Executes when the element width changes
onHeightChange
Section titled “onHeightChange”Type:
type onHeightChange = (height: number) => void;Executes when the element height changes.
Properties
Section titled “Properties”heightAction readonly
Section titled “heightAction ”Type:
type heightAction = stringThe name of the action that can be used to programmatically change the height of the element.
widthAction readonly
Section titled “widthAction ”Type:
type widthAction = stringThe name of the action that can be used to programmatically change the width of the element.
touchEnabled
Section titled “touchEnabled”Type:
type touchEnabled = booleanEnables or disables touch events. Default is false.
Methods
Section titled “Methods”deinit()
Section titled “deinit()”Removes the event listeners and disables the resize functionality.
Actions
Section titled “Actions”You are able to resize elements using actions. Since every resize action is unique you can do the following:
const element = new resize({ element: '.square' });
actions.execute(element.heightAction, 200);
actions.execute(element.widthAction, 200);