Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scrollpage() {
- let i = 0;
- let height = document.documentElement.scrollHeight;
- let direction = 0.1
- function invert() {
- direction *= -1
- }
- function scroll() {
- i += direction;
- window.scrollTo(0, i);
- if (i >= height) {
- invert();
- // wenn er wieder nach oben
- // gescrollt werden soll
- // return auskommentieren
- return;
- } else if (i <= 0) {
- invert();
- }
- setTimeout(scroll, 0.001);
- }
- scroll();
- }
- scrollpage();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement