-
Notifications
You must be signed in to change notification settings - Fork 225
Tooltips
gka edited this page Jun 4, 2012
·
6 revisions
Kartograph tooltips are based on the wonderful qTip plugin for jQuery, so you need to include at least the qTip JS and CSS files.
<script src="js/jquery.qtip.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.qtip.min.css">
Then you have two ways to add your custom tooltips to a map layer, by either passing a dictionary of path-ids or a function that returns the tooltip contents.
map.addLayer({ id: 'countries', key: 'iso3' });
tt = {
DEU: 'Here is a <em>tooltip</em> for Germany (no title)',
FRA: ['Title for France', 'Here is a <em>tooltip body</em> for France']
};
map.tooltips({
layer: 'countries',
content: tt
});
map.addLayer({ id: 'countries', key: 'iso3' });
map.tooltips({
layer: 'countries',
content: function(path_id, path) {
return 'some tooltip content'; // or ['tooltip title', 'tooltip body']
}
});