- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
js < /strong> < /p>
const element = document.getElementById('element');
const y = element.getBoundingClientRect().top + window.scrollY;
window.scroll({
top: y,
behavior: 'smooth'
});
< /code>
jsbin Пример < /p>
Подробнее здесь: https://stackoverflow.com/questions/600 ... javascript
Мобильная версия