The array of context arguments for context-sensitive positioning.
The format of the array is: [contextElementOrId, overlayCorner, contextCorner, arrayOfTriggerEvents (optional)]
, the
the 4 array elements described in detail below:
- contextElementOrId <String|HTMLElement>
- A reference to the context element to which the overlay should be aligned (or it's id).
- overlayCorner <String>
- The corner of the overlay which is to be used for alignment. This corner will be aligned to the
corner of the context element defined by the "contextCorner" entry which follows. Supported string values are:
"tr" (top right), "tl" (top left), "br" (bottom right), or "bl" (bottom left).
- contextCorner <String>
- The corner of the context element which is to be used for alignment. Supported string values are the same ones listed for the "overlayCorner" entry above.
- arrayOfTriggerEvents (optional) <Array[String|CustomEvent]>
-
By default, context alignment is a one time operation, aligning the Overlay to the context element when context configuration property is set, or when the align
method is invoked. However, you can use the optional "arrayOfTriggerEvents" entry to define the list of events which should force the overlay to re-align itself with the context element.
This is useful in situations where the layout of the document may change, resulting in the context element's position being modified.
The array can contain either event type strings for events the instance publishes (e.g. "beforeShow") or CustomEvent instances. Additionally the following
3 static container event types are also currently supported : "windowResize", "windowScroll", "textResize"
(defined in _TRIGGER_MAP private property).
For example, setting this property to ["img1", "tl", "bl"]
will
align the Overlay's top left corner to the bottom left corner of the
context element with id "img1".
Adding the optional trigger values: ["img1", "tl", "bl", ["beforeShow", "windowResize"]]
,
will re-align the overlay position, whenever the "beforeShow" or "windowResize" events are fired.