ch.Tooltip
Description
Improves the native tooltips.
How-to
Parameters
-
el
- HTMLElement : A HTMLElement to create an instance of ch.Tooltip. -
options
- Object : Options to customize an instance.-
addClass
- String : CSS class names that will be added to the container on the component initialization. -
fx
- String : Enable or disable UI effects. You must use: "slideDown", "fadeIn" or "none". Default: "fadeIn". -
width
- String : Set a width for the container. Default: "auto". -
height
- String : Set a height for the container. Default: "auto". -
shownby
- String : Determines how to interact with the trigger to show the container. You must use: "pointertap", "pointerenter" or "none". Default: "pointerenter". -
hiddenby
- String : Determines how to hide the component. You must use: "button", "pointers", "pointerleave", "all" or "none". Default: "pointerleave". -
reference
- HTMLElement : It's a reference to position and size of element that will be considered to carry out the position. Default: the trigger element. -
side
- String : The side option where the target element will be positioned. Its value can be: "left", "right", "top", "bottom" or "center". Default: "bottom". -
align
- String : The align options where the target element will be positioned. Its value can be: "left", "right", "top", "bottom" or "center". Default: "left". -
offsetX
- Number : Distance to displace the target horizontally. Default: 0. -
offsetY
- Number : Distance to displace the target vertically. Default: 10. -
position
- String : The type of positioning used. Its value must be "absolute" or "fixed". Default: "absolute". -
method
- String : The type of request ("POST" or "GET") to load content by ajax. Default: "GET". -
params
- String : Params like query string to be sent to the server. -
cache
- Boolean : Force to cache the request by the browser. Default: true. -
async
- Boolean : Force to sent request asynchronously. Default: true. -
waiting
- String | HTMLElement : Temporary content to use while the ajax request is loading. Default: ''. -
content
- String | HTMLElement : The content to be shown into the Tooltip container.
-
Extends
Properties
.Component#name
String
The name of a component.
.container
HTMLDivElement
The popover container. It's the element that will be shown and hidden.
.Popover#name
String
The name of the component.
.Tooltip#name
String
The name of the component.
.trigger
HTMLElement
The popover trigger. It's the element that will show and hide the container.
.uid
Number
A unique id to identify the instance of a component.
Methods
-
data
- String : Set a height for the container. -
content
- String | HTMLElement : The content that will be used by popover. -
options
- Object : A custom options to be used with content loaded by ajax.-
method
- String : The type of request ("POST" or "GET") to load content by ajax. Default: "GET". -
params
- String : Params like query string to be sent to the server. -
cache
- Boolean : Force to cache the request by the browser. Default: true. -
async
- Boolean : Force to sent request asynchronously. Default: true. -
waiting
- String | HTMLElement : Temporary content to use while the ajax request is loading.
-
-
data
- String : Set a width for the container.
.constructor()
Returns a reference to the constructor function.
.destroy()
Destroys an instance of Component and remove its data from asociated element.
.disable() → {component}
Disables an instance of Component.
.enable() → {component}
Enables an instance of Component.
.require() → {component}
Adds functionality or abilities from other classes.
.constructor()
Returns a reference to the constructor function.
.destroy() → {popover}
Destroys a Popover instance.
.disable() → {popover}
Disables a Popover instance.
.enable() → {popover}
Enables a Popover instance.
.height(data) → {Number|popover}
Sets or gets the height of the container.
.hide() → {popover}
Hides the popover container and deletes it from the body.
.isShown() → {Boolean}
Returns a Boolean specifying if the container is shown or not.
.refreshPosition() → {popover}
Updates the current position of the container with given options or defaults.
.show(content, options) → {popover}
Shows the popover container and appends it to the body.
.width(data) → {Number|popover}
Sets or gets the width of the container.
.constructor()
Returns a reference to the constructor function.
Events
'destroy'
Emits when a component is destroyed.
'disable'
Emits when a component is disable.
'enable'
Emits when a component is enabled.
'ready'
Event emitted when the component is ready to use.