StaticgetIf the element is already configured as a SameHeight widget, the widget instance is returned. Otherwise null.
StaticregisterOptionalconfig: SameHeightConfigReadonlydestroyUndoes all modifications to the element and returns it to its original state.
You will need to recreate it if you want to enable its functionality again.
ReadonlydisableDisables the functionality of the widget. What this means is specific to each widget.
ReadonlyenableRe-enables the functionality of the widget. What this means is specific to each widget.
ReadonlygetReturns the element passed to the widget constructor.
ReadonlygetReturns a map of the elements used as the flex children with their type.
ReadonlygetReturns the elements used as the flex children.
ReadonlyisReturns true if the widget is destroyed.
ReadonlyisReturns true if the widget is currently disabled.
ReadonlyonThe given handler will be called when the widget is destroyed.
ReadonlyonThe given handler will be called when the widget is disabled.
ReadonlyonThe given handler will be called when the widget is enabled.
ReadonlytoSwitches the flexbox to vertical (column) mode.
You can alternatively do this by setting the
data-lisn-orientation="vertical" attribute on the element at any time.
You can do this for example as part of a trigger:
ReadonlytoggleRe-enables the widget if disabled, otherwise disables it.
ReadonlytoSwitches the flexbox back to horizontal (row) mode, which is the default.
You can alternatively do this by deleting the
data-lisn-orientation attribute on the element, or setting it to
"horizontal" at any time.
Configures the given element as a SameHeight widget.
The SameHeight widget sets up the given element as a flexbox and sets the flex basis of its components so that their heights are as close as possible to each other. It tracks their size (see SizeWatcher) and continually updates the basis as needed.
When calculating the best flex basis that would result in equal heights, SameHeight determines whether a flex child is mostly text or mostly images since the height of these scales in opposite manner with their width. Therefore, the components of the widget should contain either mostly text or mostly images.
The widget should have more than one item and the items must be immediate children of the container element.
SameHeight tries to automatically determine if an item is mostly text or mostly images based on the total display text content, but you can override this in two ways:
"text"or"image"data-lisn-same-height-itemattribute to"text"or"image"on the children. NOTE however that when auto-discovering the items (i.e. when you have not explicitly passed a list/map of items), if you set thedata-lisn-same-height-itemattribute on any child you must also add this attribute to all other children that are to be used by the widget. Other children (that don't have this attribute) will be ignored and assumed to be either zero-size or position absolute/fixed.IMPORTANT: You should not instantiate more than one SameHeight widget on a given element. Use SameHeight.get to get an existing instance if any. If there is already a widget instance, it will be destroyed!
IMPORTANT: The element you pass will be set to
display: flexand its children will getbox-sizing: border-boxand continually updatedflex-basisstyle. You can add additional CSS to the element or its children if you wish. For example you may wish to setflex-wrap: wrapon the element and amin-widthon the children.To use with auto-widgets (HTML API) (see settings.autoWidgets), the following CSS classes or data attributes are recognized:
lisn-same-heightclass ordata-lisn-same-heightattribute set on the container element that constitutes the widget.When using auto-widgets, the elements that will be used as items are discovered in the following way:
lisn-same-height-itemclass ordata-lisn-same-height-itemattribute are taken.scriptorstyleelements are taken as the items.See below examples for what values you can use set for the data attribute in order to modify the configuration of the automatically created widget.
Example
This defines a simple SameHeight widget with one text and one image child.
Example
This defines a SameHeight widget with the flexbox children specified explicitly (and one ignored), as well as having all custom settings.