Reposition the tooltip when they are loaded.

At the end of the asynchronous load, the tooltips need to be
repositionned, since the size of the content may have changed.
This commit is contained in:
Francois Ferrand 2014-12-04 18:27:13 +01:00
parent 0ccf6c8bc2
commit 73e2282259
2 changed files with 29 additions and 1 deletions

View File

@ -241,10 +241,24 @@ Kanboard.Board = (function() {
return;
}
var _this = this;
$.get(href, function setTooltipContent(data) {
$('.ui-tooltip-content:visible').html(data);
var tooltip = $('.ui-tooltip:visible');
// Clear previous position, it interferes with the updated position computation
tooltip.css({ top: '', left: '' });
// Remove arrow, it will be added when repositionning
tooltip.children('.tooltip-arrow').remove();
// Reposition the tooltip
var position = $(_this).tooltip("option", "position");
position.of = $(_this);
tooltip.position(position);
// Toggle subtasks status
$('#tooltip-subtasks a').click(function(e) {

View File

@ -65,10 +65,24 @@ Kanboard.Board = (function() {
return;
}
var _this = this;
$.get(href, function setTooltipContent(data) {
$('.ui-tooltip-content:visible').html(data);
var tooltip = $('.ui-tooltip:visible');
// Clear previous position, it interferes with the updated position computation
tooltip.css({ top: '', left: '' });
// Remove arrow, it will be added when repositionning
tooltip.children('.tooltip-arrow').remove();
// Reposition the tooltip
var position = $(_this).tooltip("option", "position");
position.of = $(_this);
tooltip.position(position);
// Toggle subtasks status
$('#tooltip-subtasks a').click(function(e) {
@ -220,4 +234,4 @@ Kanboard.Board = (function() {
}
};
})();
})();