-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathtooltips.js
46 lines (37 loc) · 1.39 KB
/
tooltips.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
jQuery(document).ready(function($) {
$(document).click(function() {
$('.tooltip [display!="none"]').parent().fadeOut(100);
});
$('.tooltip').live('click', function(e) {
e.stopPropagation();
});
$('.tooltip-content').live('click', function(e) {
e.preventDefault();
});
$('.help-icon').live('click', function(event) {
if ( $( this ).hasClass('open') )
{
$( this ).removeClass('open');
$( document ).click();
} else {
event.stopPropagation();
$( this ).addClass('open');
var tooltip = $(this).siblings('.tooltip');
var tooltip_before = $(this).siblings('.tooltip').find('.tooltip-before');
if (($(document).width()) - ($(this).offset().left + 35) > tooltip.width()) {
tooltip.css("left", $(this).position().left + 35);
} else {
tooltip.css("left", $(this).position().left - (tooltip.width() + 10));
tooltip_before.css("transform", 'rotate(180deg)');
tooltip_before.css("-ms-transform", 'rotate(180deg)');
tooltip_before.css("-webkit-transform", 'rotate(180deg)');
tooltip_before.css("left", tooltip.width());
}
tooltip.css("top", $(this).position().top - 7);
tooltip.fadeIn(300);
}
});
$('.tooltip-button').live('click', function() {
$(this).parent().fadeOut(100);
});
});