Resize

Resize

new Resize(optionsopt)

Source:
Properties:
Name Type Attributes Default Description
options.node HTMLElement

The element to resize.

options.handle HTMLElement <optional>

A DOM node used as handle. If none set the element is used.

active Boolean <optional>
true

Set to false to disable resizing.

options.min Object <optional>
{x: -1, y: -1}

Object containing x and y determining minimum size. A value of -1 means no minimum.

options.max Object <optional>
{x: -1, y: -1}

Object containing x and y determining maximum size. A value of -1 means no maximum.

Resize allows resizing of elements. It does that by continuously resizing an element while the user drags a handle.

Parameters:
Name Type Attributes Default Description
options Object <optional>
{ }

An object containing initial options.

Extends

Methods

addEventListener(event, func)

Source:
Inherited From:

Register an event handler.

Parameters:
Name Type Description
event string

The event descriptor.

func function

The function to call when the event happens.

delegateEvents(element) → {HTMLElement}

Source:
Inherited From:

Delegates all occuring DOM events of a specific DOM node to the widget. This way the widget fires e.g. a click event if someone clicks on the given DOM node.

Parameters:
Name Type Description
element HTMLElement

The element all native events of the widget should be bound to.

Fires:
Returns:

The element

Type
HTMLElement

destroy()

Source:
Inherited From:

Destroys all event handlers and the options object.

dispatchEvent(event, …args)

Source:
Inherited From:

Fires an event.

Parameters:
Name Type Attributes Description
event string

The event descriptor.

args * <repeatable>

Event arguments.

get(key)

Source:
Inherited From:

Get the value of an option.

Parameters:
Name Type Description
key string

The option name.

getDefault()

Source:
Inherited From:

Returns the default value of a given option. If the option does not exist, an exception is thrown.

getOptionType()

Source:
Inherited From:

Returns the type of an option. If the given option does not exist, 'undefined' is returned.

hasEventListeners(event) → {boolean}

Source:
Inherited From:

Test if the event descriptor has some handler functions in the queue.

Parameters:
Name Type Description
event string

The event desriptor.

Returns:

True if the event has some handler functions in the queue, false if not.

Type
boolean

off(event, fun)

Source:
Inherited From:

Removes the given function from the event queue. If it is a native DOM event, it removes the DOM event listener as well.

Parameters:
Name Type Description
event string

The event descriptor.

fun function

The function to remove.

reset(key)

Source:
Inherited From:

Resets an option to its default value.

Parameters:
Name Type Description
key string

The option name.

set(key, value)

Source:
Overrides:

Sets an option. Fires both the events set with arguments key and value; and the event 'set_'+key with arguments value and key.

Parameters:
Name Type Description
key string

The name of the option.

value mixed

The value of the option.

Fires:

update(key, value)

Source:
Inherited From:

Conditionally sets an option unless it already has the requested value.

Parameters:
Name Type Description
key string

The name of the option.

value mixed

The value of the option.

Fires:

userset(key, value)

Source:
Inherited From:

Sets an option by user interaction. Emits the userset event. The userset event can be cancelled (if an event handler returns false), in which case the option is not set. Returns true if the option was set, false otherwise. If the option was set, it will emit a useraction event.

Parameters:
Name Type Description
key string

The name of the option.

value mixed

The value of the option.

Fires:
  • Base#event:userset
  • Base#event:useraction

Events

delegated

Source:
Inherited From:

Is fired when an element is delegated.

Parameters:
Name Type Description
element HTMLElement | Array

The element which receives all native DOM events.

old_element HTMLElement | Array

The element which previously received all native DOM events.

initialized

Source:
Inherited From:

Is fired when an instance is initialized.

resizestart

Source:

Is fired when resizing starts.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

resizestop

Source:

Is fired when resizing stops.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

resizing

Source:

Is fired when resizing is in progress.

Parameters:
Name Type Description
event DOMEvent

The native DOM event.

width int

The new width of the element.

height int

The new height of the element.

set

Source:
Inherited From:

Is fired when an option is set.

Parameters:
Name Type Description
name string

The name of the option.

value mixed

The value of the option.

set_[option]

Source:
Inherited From:

Is fired when an option is set.

Parameters:
Name Type Description
value mixed

The value of the option.