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 # set height of notification popover
notificationsContainer = $('.js-notificationsContainer') notificationsContainer = $('.js-notificationsContainer')
heightApp = $('#app').height() heightApp = $('#app').height()
heightPopoverSpacer = 36 heightPopoverSpacer = 22
heightPopoverHeader = notificationsContainer.find('.popover-notificationsHeader').outerHeight() heightPopoverHeader = notificationsContainer.find('.popover-notificationsHeader').outerHeight(true)
heightPopoverContent = notificationsContainer.find('.popover-content').get(0).scrollHeight heightPopoverContent = notificationsContainer.find('.popover-content').prop('scrollHeight')
heightPopoverContentNew = heightPopoverContent heightPopoverContentNew = heightPopoverContent
if (heightPopoverHeader + heightPopoverContent + heightPopoverSpacer) > heightApp if (heightPopoverHeader + heightPopoverContent + heightPopoverSpacer) > heightApp
heightPopoverContentNew = heightApp - heightPopoverHeader - heightPopoverSpacer heightPopoverContentNew = heightApp - heightPopoverHeader - heightPopoverSpacer
notificationsContainer.addClass('is-overflowing') notificationsContainer.addClass('is-overflowing')
else else
notificationsContainer.removeClass('is-overflowing') notificationsContainer.removeClass('is-overflowing')
notificationsContainer.find('.popover-content').css('height', "#{heightPopoverContentNew}px") notificationsContainer.find('.popover-content').css('height', "#{heightPopoverContentNew}px")
# close notification list on click # close notification list on click