From 73e228225909ad25e2e466fef8aa27a45ea247f0 Mon Sep 17 00:00:00 2001 From: Francois Ferrand Date: Thu, 4 Dec 2014 18:27:13 +0100 Subject: 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. --- assets/js/app.js | 14 ++++++++++++++ assets/js/board.js | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/assets/js/app.js b/assets/js/app.js index e569dace..8191fe5c 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -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) { diff --git a/assets/js/board.js b/assets/js/board.js index e02ec7f0..6e56dfa1 100644 --- a/assets/js/board.js +++ b/assets/js/board.js @@ -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() { } }; -})(); \ No newline at end of file +})(); -- cgit v1.2.3