Показать сообщение отдельно
  #2 (permalink)  
Старый 25.01.2021, 09:02
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,064

Stas1985,
попробуйте так ...
(function (jQuery) {
     var jump = function (e) {
         var target = location.hash;
         if (e) {
             e.preventDefault();
             target = $(this).attr("href");
         };
       if(!jQuery(target).length) return;
         jQuery('html,body').animate({
             scrollTop: jQuery (target).offset().top
         }, 1000, function () {
             location.hash = target;
         });
     }
     jQuery('html, body').hide();
     jQuery(document).ready(function () {
         jQuery('a[href^=#contact]').on("click", jump);
         if (location.hash) {
             setTimeout(function () {
                 jQuery('html, body').scrollTop(0).show()
                 jump();
             }, 0);
         } else {
            jQuery('html, body').show();
         }
     });
 })(jQuery)
Ответить с цитированием