[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) <qsm@odoo.com>
This commit is contained in:
Samuel Degueldre
2020-05-20 09:55:16 +00:00
parent 9f3a12b9f0
commit ecfef7abba
@@ -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