Я хочу, чтобы перейти к точке привязки на новую страницу, но я хочу, чтобы загрузить страницу в верхней части, то сразу же плавную прокрутку к соответствующей точке крепления. Это можно сделать?
Я полный новичок с Javascript.
Это js, который я использую в настоящее время для плавной прокрутки на текущей странице. Я просто применяю класс "прокрутки" по ссылке.
Большое спасибо!
<script>
$(function(){
$('.scroll').on('click',function(e) {
e.preventDefault();
$('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top + 'px' }, 1000, 'swing');
});
});
</script>