-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMarkupYahooWeather.js
More file actions
41 lines (23 loc) · 864 Bytes
/
Copy pathMarkupYahooWeather.js
File metadata and controls
41 lines (23 loc) · 864 Bytes
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
(function($) {
$.fn.tooltip = function(options) {
var set = $.extend( {
'speed' : 150
}, options);
return this.each(function() {
var tooltip = '.tooltip-wrapper';
$(this).hover(function() {
var html = '<div class="tooltip-wrapper"><div class="tooltip-arrow"><div class="tooltip-content">' + $(this).attr('data-tooltip') + '</div></div></div>';
$(this).append(html);
var marginLeft = ($(this).width() / 2) - ($(tooltip).outerWidth() / 2);
$(tooltip).css('margin-left', marginLeft + 'px');
$(tooltip).fadeIn(set.speed);
}, function() {
$(tooltip).remove();
}
);
});
};
})(jQuery);
$(document).ready(function() {
$('.weather-tooltip').tooltip();
});