API15:JHTMLBehavior/tooltip
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Contents |
Syntax
tooltip($selector='.hasTip', $params=array())
| Parameter Name | Default Value | Description |
|---|---|---|
| $selector | '.hasTip' | |
| $params | array() |
Defined in
libraries/joomla/html/html/behavior.php
Importing
jimport( 'joomla.html.html.behavior' );
Source Body
function tooltip($selector='.hasTip', $params = array()) { static $tips; if (!isset($tips)) { $tips = array(); } // Include mootools framework JHTMLBehavior::mootools(); $sig = md5(serialize(array($selector,$params))); if (isset($tips[$sig]) && ($tips[$sig])) { return; } // Setup options object $opt['maxTitleChars'] = (isset($params['maxTitleChars']) && ($params['maxTitleChars'])) ? (int)$params['maxTitleChars'] : 50 ; // offsets needs an array in the format: array('x'=>20, 'y'=>30) $opt['offsets'] = (isset($params['offsets']) && (is_array($params['offsets']))) ? $params['offsets'] : null; $opt['showDelay'] = (isset($params['showDelay'])) ? (int)$params['showDelay'] : null; $opt['hideDelay'] = (isset($params['hideDelay'])) ? (int)$params['hideDelay'] : null; $opt['className'] = (isset($params['className'])) ? $params['className'] : null; $opt['fixed'] = (isset($params['fixed']) && ($params['fixed'])) ? '\\true' : '\\false'; $opt['onShow'] = (isset($params['onShow'])) ? '\\'.$params['onShow'] : null; $opt['onHide'] = (isset($params['onHide'])) ? '\\'.$params['onHide'] : null; $options = JHTMLBehavior::_getJSObject($opt); // Attach tooltips to document $document =& JFactory::getDocument(); $tooltipInit = ' window.addEvent(\'domready\', function(){ var JTooltips = new Tips($$(\''.$selector.'\'), '.$options.'); });'; $document->addScriptDeclaration($tooltipInit); // Set static array $tips[$sig] = true; return; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
