From ecfef7abbab160585f147387904b67d6f014d8d7 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Tue, 28 Apr 2020 08:28:34 +0000 Subject: [PATCH] [FIX] website_blog: fix transition animation when going to next post In odoo/odoo#38950 the navbar was reworked such that there is only one, instead of using two different copies for when the user is at the top of the page vs when the user has scrolled a little. The transition animation to the next blog post used the first navbar's top offset to compute where it should scroll, which is no longer correct. This commit fixes that by using the content's offset instead, which should always be correct. closes odoo/odoo#51599 X-original-commit: 85cc286ff7b04eaf624082b761e14bbdde50ac76 Signed-off-by: Quentin Smetz (qsm) --- addons/website_blog/static/src/js/website_blog.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_blog/static/src/js/website_blog.js b/addons/website_blog/static/src/js/website_blog.js index 8f1f5e4951e..831bf4e7b4c 100644 --- a/addons/website_blog/static/src/js/website_blog.js +++ b/addons/website_blog/static/src/js/website_blog.js @@ -92,8 +92,8 @@ publicWidget.registry.websiteBlog = publicWidget.Widget.extend({ * @param {Function} callback - to be executed after the scroll is performed */ _forumScrollAction: function ($el, duration, callback) { - var $mainNav = $('#wrapwrap > header'); - var gap = $mainNav.height() + $mainNav.offset().top; + const $main = $('#wrapwrap > main'); + var gap = $main.offset().top + parseInt($main.css('padding-top')); $('html, body').stop().animate({ scrollTop: $el.offset().top - gap