From afba9e8817c458640ae446ac7aaaab79be4fe1e9 Mon Sep 17 00:00:00 2001 From: Julien Legros Date: Thu, 4 Sep 2014 17:47:00 +0200 Subject: [PATCH] [FIX] web_tip: don't display tip on element whose width or height is 0 This commit allows a tip to be properly displayed on elements containing an img tag. Previously the tip would be displayed before the image could be loaded, thus breaking the ui. --- addons/web_tip/static/src/js/tip.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/web_tip/static/src/js/tip.js b/addons/web_tip/static/src/js/tip.js index a07eb533039..c5d6d7c49b7 100644 --- a/addons/web_tip/static/src/js/tip.js +++ b/addons/web_tip/static/src/js/tip.js @@ -159,6 +159,16 @@ if (trigger_tip) { self.$element = $(highlight_selector).first(); + if (self.$element.height() === 0 || self.$element.width() === 0) { + var $images = self.$element.find('img'); + if ($images.length > 0) { + $images.first().load(function() { + self.add_tip(tip); + }); + } + return def.reject(); + } + var _top = self.$element.offset().top -5; var _left = self.$element.offset().left -5; var _width = self.$element.outerWidth() + 10;