CNET JS Code Documentation
Class: OverText
Shows text over an input that disappears when the user clicks into it. The text remains hidden if the user adds a value.
Author: Aaron Newton
Implements
Syntax
new OverText(inputs[, options]);
Arguments
- inputs - (array) a collection of DOM elements that should receive the hover text
- options - (object, optional) a key/value set of options
Options
- positionOptions - (object) data passed to Element.setPosition
Events
- onTextHide - (function) callback fired when an overtext element is hidden (passed the overtext element and the input element as arguments)
- onTextShow - (function) callback fired when an overtext element is shown (passed the overtext element and the input element as arguments)
OverText Method: hideTxt
Hides the overtext element for a given input.
Syntax
myOverText.hideTxt(element);
Arguments
- element - (mixed) A string of the id for an Element or an Element reference whose overtext element should be hidden
Returns
- (object) - This instance of OverText
OverText Method: showTxt
Shows the overtext element for a given input.
Syntax
myOverText.showTxt(element);
Arguments
- element - (mixed) A string of the id for an Element or an Element reference whose overtext element should be shown
Returns
- (object) - This instance of OverText.
OverText Method: repositionAll
Repositions each overtext element over its appropriate input.
Returns
- (object) - This instance of OverText
OverText Method: repositionOverTxt
Repositions the appropriate overtext element over a given input.
Syntax
myOverText.repositionOverTxt(input);
Arguments
- input - (mixed) A string of the id for an Element or an Element reference whose overtext element should be repositioned
Returns
- (object) - This instance of OverText
Native: Element
Extends the native Element object with a reference to its OverText instance.
Element property: overtext
Syntax
myInput.retrieve('overtext'); //the instance of OverText for the element