1
  $('.menu a, .footer__logo, .footer__list a').on('click', function (event) {
    event.preventDefault();
    var id = $(this).attr('href'),
      top = $(id).offset().top;
    $('body,html').animate(
      {
        scrollTop: top,
      },
      1200,
    );
  });
});
0

1 ответ 1

1

Можно скролить к месту чуть выше блока на размер хедера:

$('.menu a, .footer__logo, .footer__list a').on('click', function (event) {
    event.preventDefault();
    var id = $(this).attr('href'),
        top = $(id).offset().top - $('.header').outerHeight();
    $('body,html').animate({ scrollTop: top }, 1200 );
});

1
  • 1
    Гениально, это то - что мне и нужно было, спасибо большое! Поднял ответ 11 авг 2021 в 13:06

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.