diff options
author | Francois Ferrand <thetypz@gmail.com> | 2014-12-04 18:27:13 +0100 |
---|---|---|
committer | Francois Ferrand <thetypz@gmail.com> | 2014-12-04 18:37:56 +0100 |
commit | 73e228225909ad25e2e466fef8aa27a45ea247f0 (patch) | |
tree | 0b40e2e73071507cc435c7a5015d06a3b8b32681 /assets/js | |
parent | 0ccf6c8bc20656921f31582a0b5b329264dd6813 (diff) |
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.
Diffstat (limited to 'assets/js')
-rw-r--r-- | assets/js/app.js | 14 | ||||
-rw-r--r-- | assets/js/board.js | 16 |
2 files changed, 29 insertions, 1 deletions
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 +})(); |