From: rabuzarus <> Date: Fri, 6 May 2016 15:32:07 +0000 (+0200) Subject: hovercard: better placement management X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0ab7a210f9e0f67d4b49035170df7852204b8be2;p=friendica.git hovercard: better placement management --- diff --git a/js/hovercard.js b/js/hovercard.js index 9b326dcd3e..1fce282c08 100644 --- a/js/hovercard.js +++ b/js/hovercard.js @@ -62,7 +62,16 @@ $(document).ready(function(){ if(data) { targetElement.popover({ html: true, - placement: 'auto', + placement: function () { + // Calculate the placement of the the hovercard (if top or bottom) + // The placement depence on the distance between window top and the element + // which triggers the hover-card + var get_position = $(targetElement).offset().top - $(window).scrollTop(); + if (get_position < 270 ){ + return "bottom"; + } + return "top"; + }, trigger: 'manual', template: '
', content: data