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
This commit is contained in:
Felix Niklas 2015-06-10 12:37:27 +02:00
parent 0a3198deed
commit 89f37809b6

View file

@ -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