Fixed safari issue with .position().top == 0 and "see more" feature.
This commit is contained in:
parent
42ac0ea2bf
commit
d101717668
1 changed files with 11 additions and 1 deletions
|
@ -178,6 +178,7 @@ class ArticleViewItem extends App.Controller
|
||||||
@shown = true
|
@shown = true
|
||||||
|
|
||||||
maxHeight = 560
|
maxHeight = 560
|
||||||
|
minHeight = 90
|
||||||
bubbleContent = @textBubbleContent
|
bubbleContent = @textBubbleContent
|
||||||
bubbleOvervlowContainer = @textBubbleOverflowContainer
|
bubbleOvervlowContainer = @textBubbleOverflowContainer
|
||||||
|
|
||||||
|
@ -194,11 +195,20 @@ class ArticleViewItem extends App.Controller
|
||||||
# remember offset of "see more"
|
# remember offset of "see more"
|
||||||
offsetTop = bubbleContent.find('.js-signatureMarker').position()
|
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
|
# remember bubble heigth
|
||||||
heigth = bubbleContent.height()
|
heigth = bubbleContent.height()
|
||||||
if offsetTop && heigth
|
if offsetTop && heigth
|
||||||
|
newHeigth = offsetTop.top + 30
|
||||||
|
if newHeigth < minHeight
|
||||||
|
newHeigth = minHeight
|
||||||
bubbleContent.attr('data-height', heigth)
|
bubbleContent.attr('data-height', heigth)
|
||||||
bubbleContent.css('height', "#{offsetTop.top + 30}px")
|
bubbleContent.css('height', "#{newHeigth}px")
|
||||||
bubbleOvervlowContainer.removeClass('hide')
|
bubbleOvervlowContainer.removeClass('hide')
|
||||||
else if heigth > maxHeight
|
else if heigth > maxHeight
|
||||||
bubbleContent.attr('data-height', heigth)
|
bubbleContent.attr('data-height', heigth)
|
||||||
|
|
Loading…
Reference in a new issue