This is a hint widget, that shows hints (or “tool tips”) near elements
Mikkel Bergmann, http://www.pointful.com
| pax. | This is a hint widget, that shows hints (or “tool tips”) near elements |
| Functions | |
| pax. | Shows hints at the given targets |
pax.widget.hint.init = function( args, defaultModel )
Shows hints at the given targets
| target | an element to render the hint into |
| args | arguments for the grid widget |
Element of the hint
<a href='#' id='widget.hint.init.example1'>Hover me for hint</a>
[:.
pax.widget.hint.init( {
'widget.hint.init.example1': 'testing 123'
} );
:]This example shows a simple hint
<a href='#' id='widget.hint.init.example2'>Hover me for hint that fades in and out, with a delay</a>
[:.
pax.widget.hint.init( {
'widget.hint.init.example2': {
showFunc: pax.fx.fadeIn,
hideFunc: pax.fx.fadeOut,
opacity: 0,
message: 'testing 123<br>new line',
showDelay: 300,
hideDelay: 2000
}
} );
:]This example shows a hint that fades in and out. Note the use of “opacity: 0”, as that is required for the fadein.
<a href='#' id='widget.hint.init.example3'>Hover me for hint that fades in and out, with a delay</a>
<img src='http://paxjs.com/resource/logo.png' id='widget.hint.init.example3.img'/>
[:.
pax.widget.hint.init( {
'widget.hint.init.example2': {
message: 'testing 123<br>new line',
showFunc: null,
showDelay: null
},
'widget.hint.init.example3.img': 'This is a message from an image hover'
}, {
showFunc: pax.fx.fadeIn,
hideFunc: pax.fx.fadeOut,
opacity: 0,
showDelay: 300,
hideDelay: 2000
} );
:]This example shows two hints that fade in and out. We are using the defaultModel feature, to allow the hints to share the configuration. Note that you can override the default configuration parameters, by specifying them within each hint, as done on the first hint.
<a href='#' id='widget.hint.init.example4'>Hover me for hint initialised from the title attribute</a>
[:.
pax.widget.hint.init( ['widget.hint.init.example4'] } );
:]This example shows a hint that uses the title attribute for the message, this allows fallback if JS is not available. Note that you can set which attribute to use, by specifying a messageAttribute in the configuration
Shows hints at the given targets
pax.widget.hint.init = function( args, defaultModel )