Tooltip command
Show additional information on hovering a link.
Basic Usage (HTML)
data-jkit="[tooltip:text=Your tooltip text]"
Advanced Init (JavaScript)
$('#myelement').jKit('tooltip', { 'text': 'Your tooltip text' });
Options
Option | Values | Default | Description |
---|---|---|---|
text | HTML | The HTML text to display inside the tooltip | |
content | jQuery selector | An optional element that contains the content | |
color | Hex Color | #fff | The color of the tooltip text |
background | Hex Color | #000 | The color of the tooltip background |
classname | String | CSS class to apply on the tooltip | |
follow | “yes” or “no” | no | Follow the mouse or not? |
event | String “mouse” or “focus” | mouse | On what kind of event to show the tooltip? |
yoffset | Int | 20 | Tooltip offset on the Y axis. |
Events
Event | Description |
---|---|
open | Triggered when the tooltip is shown |
closed | Triggered when the tip is closed |
Examples
Basic example:
Some basic tooltips showing the different styling options:
Source:
<a href="#" data-jkit="[tooltip:color=#fff;background=#999;text=Test Tooltip Text]">Test Link</a> <a href="#" data-jkit="[tooltip:color=#333;background=#E01B49;text=Test Tooltip Text 2]">Test Link 2</a> <a href="#" data-jkit="[tooltip:classname=mytooltip;text=Test Tooltip Text 3]">Test Link with a class for styling</a>
Advanced example:
Some more examples showing the other options available:
Source:
<a href="#" data-jkit="[tooltip:content=#tooltipcontent]">Content from a hidden div</a> <a href="#" data-jkit="[tooltip]" title="Test Tooltip Text 4">Text from title attribute</a> <a href="#" data-jkit="[tooltip]" alt="Test Tooltip Text 5">Text from alt attribute</a> <a href="#" data-jkit="[tooltip:follow=yes;text=Test Tooltip Text 6]">Follow the mouse</a> <br /> <input type="text" name="test" data-jkit="[tooltip:event=focus;text=Test Tooltip Text 7]"> <div id="tooltipcontent" style="display:none"> <h4>Header</h4> <p>Paragraph</p> </div>
Example CSS
div#jkit-tooltip { padding: 4px; padding-left: 8px; padding-right: 8px; position: absolute; } .mytooltip { background: #333; color: #fff; padding: 6px; padding-bottom: 5px; opacity: 0.9; border: 1px #E01B49 solid; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow:0 0 5px #aaa; -moz-box-shadow: 0 0 5px #aaa; box-shadow:0 0 5px #aaa; }
Replacements
There are currently no replacements for this command.
[ Learn more about replacements ]
Discussions
Do you have questions or do you want to suggest new features? Than head over to our new community:
[ jKit Community ]