Animating windows.scrollby in Javascript

So I use window.scrollby similar to this

<script> function scrollWindowup() { window.scrollBy(0,700) } function scrollWindowdown() { window.scrollBy(0,-700) } </script> 

Is there a way to animate it, like moving slowly or shifting, or any other option?

early

+4
source share
1 answer

From a similar question ...

You can animate scrolltop pages using jQuery .

 $('html, body').animate({ scrollTop: $(".middle").offset().top }, 2000); 

or

 $('html, body').animate({ scrollTop: 700 }, 2000); 

Page animation:

 $('html, body').animate({ scrollTop: '+=700' }, 2000); 

Page Animation:

 $('html, body').animate({ scrollTop: '-=700' }, 2000); 

See this site: http://papermashup.com/jquery-page-scrolling/

+11
source

Source: https://habr.com/ru/post/1439964/


All Articles