From 89f37809b6f2c1450ed5dbfc24ca92cd59996b05 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Wed, 10 Jun 2015 12:37:27 +0200 Subject: [PATCH] fix notification popover height calculation - get scrollHeight via .prop() - get header height including margins by passing a true with .outerHeight() - add 2 pixels to the popoverspacer of 2x10 for the top and bottom border of the container --- .../app/controllers/widget/online_notification.js.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee index 1f54ca68b..fb74bebce 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee @@ -64,15 +64,16 @@ class App.OnlineNotificationWidget extends App.Controller # set height of notification popover notificationsContainer = $('.js-notificationsContainer') heightApp = $('#app').height() - heightPopoverSpacer = 36 - heightPopoverHeader = notificationsContainer.find('.popover-notificationsHeader').outerHeight() - heightPopoverContent = notificationsContainer.find('.popover-content').get(0).scrollHeight + heightPopoverSpacer = 22 + heightPopoverHeader = notificationsContainer.find('.popover-notificationsHeader').outerHeight(true) + heightPopoverContent = notificationsContainer.find('.popover-content').prop('scrollHeight') heightPopoverContentNew = heightPopoverContent if (heightPopoverHeader + heightPopoverContent + heightPopoverSpacer) > heightApp heightPopoverContentNew = heightApp - heightPopoverHeader - heightPopoverSpacer notificationsContainer.addClass('is-overflowing') else notificationsContainer.removeClass('is-overflowing') + notificationsContainer.find('.popover-content').css('height', "#{heightPopoverContentNew}px") # close notification list on click