From fcd5e6896cdd9f8f7821166e96fbec4c15c8a2a1 Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Fri, 25 Sep 2020 11:03:47 +0000 Subject: [PATCH] [FIX] website: fix table of content navbar links when scrolling Before this commit active navbar links were not correctly updated with the scroll position. task-2312878 closes odoo/odoo#58871 X-original-commit: a0ef5b0ea5e6025d6121849c2c98c077d86e237b Signed-off-by: Quentin Smetz (qsm) --- addons/website/static/src/snippets/s_table_of_content/000.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/website/static/src/snippets/s_table_of_content/000.js b/addons/website/static/src/snippets/s_table_of_content/000.js index 68250bc88fa..a98727a1306 100644 --- a/addons/website/static/src/snippets/s_table_of_content/000.js +++ b/addons/website/static/src/snippets/s_table_of_content/000.js @@ -39,6 +39,9 @@ const TableOfContent = publicWidget.Widget.extend({ const isHorizontalNavbar = this.$target.hasClass('s_table_of_content_horizontal_navbar'); this.$target.css('top', isHorizontalNavbar ? position : ''); this.$target.find('.s_table_of_content_navbar').css('top', isHorizontalNavbar ? '' : position + 20); + const $mainNavBar = $('#oe_main_menu_navbar'); + position += $mainNavBar.length ? $mainNavBar.outerHeight() : 0; + position += isHorizontalNavbar ? this.$target.outerHeight() : 0; $().getScrollingElement().scrollspy({target: '.s_table_of_content_navbar', method: 'offset', offset: position + 100}); }, });