From 2b5a9ad56ee55fe8153eed8e14c44bfa7fe21c3b Mon Sep 17 00:00:00 2001 From: Zog Date: Fri, 23 Feb 2018 15:50:41 +0100 Subject: Refs #5952; Add an hysteresis on the sticky header --- app/assets/javascripts/main_menu.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/assets') diff --git a/app/assets/javascripts/main_menu.coffee b/app/assets/javascripts/main_menu.coffee index e943f448a..22ecebd25 100644 --- a/app/assets/javascripts/main_menu.coffee +++ b/app/assets/javascripts/main_menu.coffee @@ -21,8 +21,9 @@ $ -> sticker = () -> limit = 51 + offset = 30 - if $(window).scrollTop() >= limit + if $(window).scrollTop() >= limit + offset if stickyActions.length == 0 if ($('.page-action .small').length > 0) stickyActions.push @@ -53,7 +54,7 @@ $ -> for child in item.content child.appendTo $('.sticky-paction') - else + else if $(window).scrollTop() <= limit - offset $('#main_nav').removeClass 'sticky' if $('#menu_top').find('.sticky-content').length > 0 -- cgit v1.2.3