Angular Tooltips is an angularjs directive that generates a tooltip on your element.
The angular tooltips is developed by 720kb.
##Requirements
AngularJS v1.2+
###Browser support
✔ | ✔ | IE9 + | ✔ | ✔ |
To use the directive, include the angular tooltips's javascript and css files in your web page:
<!DOCTYPE HTML>
<html>
<head>
<link href="src/css/angular-tooltips.css" rel="stylesheet" type="text/css" />
</head>
<body ng-app="app">
//.....
<script src="src/js/angular-tooltips.js"></script>
</body>
</html>
##Installation
####Bower
$ bower install angular-tooltips --save
####Npm
$ npm install angular-tooltips --save
then load the js files in your html
####Add module dependency
Add the 720kb.tooltips module dependency
angular.module('app', [
'720kb.tooltips'
]);
Call the directive wherever you want in your html page
<a href="#" tooltips title="tooltip">Tooltip me</a>
##Doc
Option | Type | Default | Description |
---|---|---|---|
tooltip-side="" | String('left','right','top','bottom') | 'top' | Set your tooltip to show on left or right or top or bottom position |
tooltip-size="" | String('medium','small','large') | 'medium' | Set your tooltip size |
tooltip-speed="" | String('fast','medium','slow', Int(ms)) | 'medium' | Set your tooltip transition speed |
tooltip-delay="" | Int(ms)) | 0 | Set your tooltip transition delay |
tooltip-title="" | String() | false | Set your tooltip title |
tooltip-content="" | String() | false | Set your tooltip content |
tooltip-html="" | String() | false | Set your tooltip HTML content |
tooltip-view="" | String() | false | Set your tooltip view PATH |
tooltip-view-model="" | String() | false | Set your tooltip view model |
tooltip-view-ctrl="" | String() | false | Set your tooltip view controller |
tooltip-try="" | String(Boolean) | false | Set your tooltip to automatically search for an alternative position |
tooltip-lazy="" | String(Boolean) | true | Re-init the tooltip position everytime is shown |
tooltip-show-trigger="" | String('event1 event2') | 'mouseover' | Show the tooltip on specific event/events |
tooltip-hide-trigger="" | String('event1 event2') | 'mouseleave' | Hide the tooltip on specific event/events |
tooltip-hide-trigger-target="" | String('element', 'tooltip') | 'element' | Hide the tooltip on specific target event/events |
tooltip-close-button="" | String(HTML) | false | Set the tooltip HTML close button |
tooltip-class="" | String() | false | Set the tooltip custom CSS class/classes |
tooltip-scroll="" | String(Boolean) | false | Set the tooltip to follow the element on scroll/move |
tooltip-parent="" | String('#id') | '' | Set the tooltip DOM parent by ID |
##Options
Angular tooltips allows you to use some options via attribute
data
####Globals
Application wide defaults for most of the options can be set using the tooltipConfigProvider
:
angular
.module('app')
.config(function(tooltipsConfigProvider) {
tooltipsConfigProvider.options({
lazy: false,
size: 'large'
})
});
Options that are not specified are kept unchanged.
Option names are the same as attribute names without the "tooltip-" prefix: scroll
, showTrigger
, hideTrigger
,
hideTarget
, side
, size
, try
, class
, speed
, delay
, lazy
, closeButton
Of course specific tooltips can still overwrite any default using attributes.
Calling options
method without arguments returns the complete options object.
###Live demo
##Theming
You can edit the default Css file angular-tooltips.css
if you want to make a new theme for the tooltips.
##Contributing
We will be much grateful if you help us making this project to grow up. Feel free to contribute by forking, opening issues, pull requests etc.
The MIT License (MIT)
Copyright (c) 2014 Filippo Oretti, Dario Andrei
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.