Answer the question
In order to leave comments, you need to log in
How to make a smooth, not jerky scrollTop in Angular v.1?
Actually the whole question in the topic. Looked around a bunch of resources, found nothing. That delay, then twitches, everything is not of high quality.
Answer the question
In order to leave comments, you need to log in
It's just not clear what Angular has to do with it.
// Плавная прокрутка в начало
document.querySelector('.goTop').addEventListener('click', function() {
return up();
});
function up() {
// чем меньше значение, тем выше скорость перемещения
window.scrollBy(0, -30);
// если значение меньше нуля, то скролл на верху
if (window.pageYOffset > 0) {
return requestAnimationFrame(up);
}
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question