This does not work in Chrome or Firefox.
window.scrollTo(window.scrollX, window.scrollY);
This works on both:
window.scrollTo(window.scrollX, window.scrollY - 1); window.scrollTo(window.scrollX, window.scrollY + 1);
I do not like it, but it works.
Please note that you only need the first line of code, the other only to return scrolling back to where it was. I had to call the scroll function on the button. If you press the button twice, the scroll effect is seen, and it is not very interesting. Therefore, I prefer to add a second line of code.
source share