This time I will share jQuery Plugin and tutorial about Simple Flexible jQuery Tooltip Plugin For jQuery – Cooltip.js, hope it will help you in programming stack.
Cooltip.js is a simple, flexible jQuery plugin to enhance the default browser tooltips that allow you to display any content inside your tooltips.
Features:
- Custom trigger events: hover or click.
- Accepted directions are top, right, bottom, and left.
- Fully styleable via CSS.
How to use it:
1. Load the jQuery cooltip.js after you have jQuery javascript library loaded.
1 |
< script src = "//code.jquery.com/jquery-1.11.3.min.js" ></ script > |
2 |
< script src = "js/cooltip.js" ></ script > |
2. By default, the tooltip content is extracted from your element’s title
attribute if not set in config.
1 |
< a href = "#" id = "demo" title = "Here is a tooltip!" >Hover me</ a > |
3. The core CSS styles for the tooltip. You can modify or override the CSS rules displayed below to create your own tooltip styles.
03 |
background-color : rgba( 20 , 20 , 20 , 0.85 ); |
05 |
padding : 0.5 rem 0.7 rem; |
10 |
.cooltip.direction- top { margin-top : -0.7 rem; } |
12 |
.cooltip.direction- top :after { |
17 |
border-top : 0.4 rem solid rgba( 20 , 20 , 20 , 0.85 ); |
18 |
border-right : 0.4 rem solid transparent ; |
19 |
border-bottom : 0.4 rem solid transparent ; |
20 |
border-left : 0.4 rem solid transparent ; |
22 |
left : calc( 50% - . 4 rem); |
25 |
.cooltip.direction- right { margin-left : 0.7 rem; } |
27 |
.cooltip.direction- right :after { |
32 |
border-top : 0.4 rem solid transparent ; |
33 |
border-right : 0.4 rem solid rgba( 20 , 20 , 20 , 0.85 ); |
34 |
border-bottom : 0.4 rem solid transparent ; |
35 |
border-left : 0.4 rem solid transparent ; |
36 |
top : calc( 50% - . 4 rem); |
40 |
.cooltip.direction- bottom { margin-top : 0.7 rem; } |
42 |
.cooltip.direction- bottom :after { |
47 |
border-top : 0.4 rem solid transparent ; |
48 |
border-right : 0.4 rem solid transparent ; |
49 |
border-bottom : 0.4 rem solid rgba( 20 , 20 , 20 , 0.85 ); |
50 |
border-left : 0.4 rem solid transparent ; |
52 |
left : calc( 50% - . 4 rem); |
55 |
.cooltip.direction- left { margin-left : -0.7 rem; } |
57 |
.cooltip.direction- left :after { |
62 |
border-top : 0.4 rem solid transparent ; |
63 |
border-right : 0.4 rem solid transparent ; |
64 |
border-bottom : 0.4 rem solid transparent ; |
65 |
border-left : 0.4 rem solid rgba( 20 , 20 , 20 , 0.85 ); |
66 |
top : calc( 50% - . 4 rem); |
70 |
.cooltip.direction- top .align- right :after, .cooltip.direction- bottom .align- right :after { left : 0.3 rem; } |
72 |
.cooltip.direction- top .align- left :after, .cooltip.direction- bottom .align- left :after { |
77 |
.cooltip.direction- right .align- top :after, .cooltip.direction- left .align- top :after { |
source : jqueryscript.net