Присвоение всем моим триггерным элементам виджета qTip:
Код: Выделить всё
$('.trigger_element').each(function() {
$(this).qtip({
content: $(this).find('.trigger_element_content').html(),
hide: {
fixed: true, // Keep open when mouse is over tooltip.
delay: 150, // Close after 150ms. Necessary for keeping open when moving mouse from trigger element to tooltip.
effect: function() {
$(this).fadeOut(200)
}
},
show: {
effect: function() {
$(this).fadeIn(200);
}
},
position: {
viewport: true, // Only showing tooltip in a visible area.
my: 'top center', // Setting anchor of tooltip.
at: 'bottom center', // Placing the tooltip to trigger element.
collision: 'flip' // Flipping tooltip to opposite site when it doesn't fit.
}
});
});
Код: Выделить всё
$('.trigger_element').click(function() {
$(this).qtip('option', {
hide: {
event: false,
// Although our target "$(this)" is known, qTip2 got a bug here.
// If we omit the target option, qTip2 will throw an error
// which says that our target is undefined.
target: $(this)
}
});
});
Как должен вести себя мой код:
Когда я наведу указатель мыши на один из моих триггерных элементов, должна открыться всплывающая подсказка. Когда я выхожу с помощью мыши, всплывающая подсказка должна скрываться.
НО, когда я нажимаю на триггерный элемент, всплывающая подсказка должна оставаться открытой, даже если я выхожу с помощью мыши.
Подробнее здесь: https://stackoverflow.com/questions/327 ... oesnt-work
Мобильная версия