t = {
initTooltip: function() {
var $tooltipsCircles = $('.js-tooltip-circles');
$tooltipsCircles.tooltip({
show: 'fold',
position: {
my: 'center bottom-20',
at: 'center top',
using: function(position, feedback) {
$(this).css(position);
$('
')
.addClass('ui-tooltip-arrow')
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
},
close: function(event, ui) {
var $target = $(this);
$target.data('topen', false);
ui.tooltip.hover(function() {
$target.data('topen', Number(new Date()));
$(this).stop(true).fadeTo(500, 1);
}, function() {
$(this).fadeOut('500', function() {
$target.data('topen', false);
$(this).remove();
});
});
},
open: function(event, ui) {
console.log('open');
$(this).data('topen', Number(new Date()));
}
});
$tooltipsCircles.on('click', function(ev) {
ev.preventDefault();
var $target = $(ev.currentTarget),
topen = $target.data('topen'),
abs = topen ? Math.abs(Number(new Date()) - topen) : 0;
if (topen && abs > 250) {
$target.tooltip('close');
}
if (!topen) {
$target.tooltip('open');
}
});
function refresh() {
$tooltipsCircles.tooltip('close');
$tooltipsPyramid.tooltip('close');
}
if (window.addEventListener) {
window.addEventListener('resize', refresh, false);
} else if (window.attachEvent) {
window.attachEvent('onresize', refresh);
}
}
}
////////////////
(function($) {
$(function() {
$('.js-tooltip-method-unavailable').tooltip({
tooltipClass: 'tooltip-method-unavailable',
position: {
my: "center top",
at: "center bottom+10",
using: function(position, feedback) {
$(this).css(position);
$('
')
.addClass('ui-tooltip-arrow')
.addClass(feedback.vertical)
.addClass(feedback.horizontal)
.appendTo(this);
}
}
});
});
})(jQuery);