From d1017176688315fb4c9668eb633a4fe0b5c3fd63 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 12 Feb 2016 11:18:39 +0100 Subject: [PATCH] Fixed safari issue with .position().top == 0 and "see more" feature. --- .../app/controllers/ticket_zoom/article_view.coffee | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee index 0a1645495..da24eeaa8 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_view.coffee @@ -178,6 +178,7 @@ class ArticleViewItem extends App.Controller @shown = true maxHeight = 560 + minHeight = 90 bubbleContent = @textBubbleContent bubbleOvervlowContainer = @textBubbleOverflowContainer @@ -194,11 +195,20 @@ class ArticleViewItem extends App.Controller # remember offset of "see more" offsetTop = bubbleContent.find('.js-signatureMarker').position() + # safari - workaround + # in safari somethimes the marker is directly on top via .top and inspector but it isn't + # in this case use the next element + if offsetTop && offsetTop.top is 0 + offsetTop = bubbleContent.find('.js-signatureMarker').next('div, p').position() + # remember bubble heigth heigth = bubbleContent.height() if offsetTop && heigth + newHeigth = offsetTop.top + 30 + if newHeigth < minHeight + newHeigth = minHeight bubbleContent.attr('data-height', heigth) - bubbleContent.css('height', "#{offsetTop.top + 30}px") + bubbleContent.css('height', "#{newHeigth}px") bubbleOvervlowContainer.removeClass('hide') else if heigth > maxHeight bubbleContent.attr('data-height', heigth)