diff --git a/www/include/jquery.tooltip.js b/www/include/jquery.tooltip.js index bdb754d591..11ddd4e4ae 100644 --- a/www/include/jquery.tooltip.js +++ b/www/include/jquery.tooltip.js @@ -40,6 +40,7 @@ fade: true, showURL: true, outside: true, + isBrowsable: false, extraClass: "", top: 15, left: 15, @@ -199,7 +200,8 @@ helper.url.hide(); // add an optional class for this tip - // helper.parent.addClass(settings(this).extraClass); + helper.parent.removeClass(); + helper.parent.addClass(settings(this).extraClass); if (this.ajaxLoad) { clearTimeout($.tooltip.ajaxTimeout); $.tooltip.ajaxTimeout = setTimeout("$.tooltip.delayAjax()", 300); @@ -470,6 +472,20 @@ } else { helper.parent.show(); } + + + $(helper.parent[0]) + .unbind('mouseleave') + .mouseleave(function () { + if (settings($.tooltip.current).isBrowsable) { + // if tooltip has scrollable content or selectionnable text - should be closed on mouseleave: + $.tooltip.currentHover = false; + helper.parent.hide(); + } else { + console.log('ok owned') + } + }); + update(); } @@ -510,11 +526,13 @@ // stop updating when tracking is disabled and the tooltip is visible if (!track && helper.parent.is(":visible")) { $(document.body).unbind('mousemove', update); + $.tooltip.currentHover = true; } // if no current element is available, remove this listener if ($.tooltip.current === null) { $(document.body).unbind('mousemove', update); + $.tooltip.currentHover = false; return; } @@ -573,8 +591,16 @@ // hide helper and restore added classes and the title function hide(event) { + if( $.tooltip.currentHover && settings($.tooltip.current).isBrowsable ) { + return; + } + if ($.tooltip.blocked || !$.tooltip.current) return; + + $(helper.parent[0]) + .unbind('mouseleave'); + // clear timeout if possible if (tID) clearTimeout(tID); diff --git a/www/skins/prod/Prod.css b/www/skins/prod/Prod.css index e865b71467..121e6a74bc 100644 --- a/www/skins/prod/Prod.css +++ b/www/skins/prod/Prod.css @@ -11,4 +11,15 @@ #answers { overflow-x: hidden; overflow-y: auto; -} \ No newline at end of file +} + +.caption-tooltip-container { + max-width: 500px; + +} +.caption-tooltip-container .popover-inner .popover-content { + max-width: 500px; + max-height: 500px; + overflow: auto; + overflow-x: hidden; +} diff --git a/www/skins/prod/jquery.main-prod.js b/www/skins/prod/jquery.main-prod.js index 0ad3314a9a..4dde636d88 100644 --- a/www/skins/prod/jquery.main-prod.js +++ b/www/skins/prod/jquery.main-prod.js @@ -390,7 +390,12 @@ function afterSearch() { answAjaxrunning = false; $('#answers').removeClass('loading'); - $('.captionTips, .captionRolloverTips, .infoTips').tooltip({ + $('.captionTips, .captionRolloverTips').tooltip({ + delay: 0, + isBrowsable: true, + extraClass: 'caption-tooltip-container' + }); + $('.infoTips').tooltip({ delay: 0 }); $('.previewTips').tooltip({ @@ -591,7 +596,6 @@ function getFacetsTree() { s_closer.click( function(event) { - console.debug(this); event.stopPropagation(); var facetTitle = $(this).data("facetTitle"); delete selectedFacetValues[facetTitle];