[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) <qsm@odoo.com>
This commit is contained in:
Benjamin Vray
2020-09-29 21:00:41 +00:00
parent 1e1627001a
commit fcd5e6896c
@@ -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});
},
});