ch.Positioner (Class)
Documentation updated on Fri Jul 06 2012, generated by JsDoc Toolkit.
Overview
Positioner lets you centralize and manage changes related to positioned elements. Positioner returns an utility that resolves positioning for all widget.
View source on GitHubRequires
Returns
Function
The Positioner returns a Function that it works in 3 ways: as a setter, as a getter and with the "refresh" parameter refreshes the position.
Use
Instance the Positioner It requires a little configuration. The default behavior place an element centered into the Viewport.
var positioned = ch.positioner({
element: "#element1",
});
1. Getting the current configuration properties.
var configuration = positioned()
2. Updates the current position with refresh as a parameter.
positioned("refresh");
3. Define a new position
positioned({
element: "#element2",
context: "#context2",
points: "lt rt"
});
Offset: The positioner could be configurated with an offset. This example show an element displaced horizontally by 10px of defined position.
var positioned = ch.positioner({
element: "#element3",
context: "#context3",
points: "lt rt",
offset: "10 0"
});
Reposition: Repositionable feature moves the postioned element if it can be shown into the viewport.
var positioned = ch.positioner({
element: "#element4",
context: "#context4",
points: "lt rt",
reposition: true
});
Configuration
The following options lets you create a customized ch.Positioner:
-
conf: Object Configuration object with positioning properties. -
conf.element: String Reference to the DOM Element to be positioned. -
conf.context: String It's a reference to position and size of element that will be considered to carry out the position. If it isn't defined through configuration, it will be the viewport. -
conf.points: String Points where element will be positioned, specified by configuration or centered by default. -
conf.offset: String Offset in pixels that element will be displaced from original position determined by points. It's specified by configuration or zero by default. -
conf.reposition: Boolean Parameter that enables or disables reposition intelligence. It's disabled by default.