Anyone have any ideas why scrollTop isn\'t working in IE?
It works in Chrome fine, and I don\'t know about firefox. (The idea of this script is to have an autoscroll
Try:
document.documentElement.scrollTop = x // where x is some integer
Solution for EDGE needs to set scrollTop on scrollingElement document property:
document.scrollingElement.scrollTop= x; // x is integer value
But you have to ensure, that CSS on HTML element has set overflow to default value (visible):
html {
overflow: visible;
}
The reason things like this don't work on one browser or another is usually due to something like:
window.document.body.scrollTop++;
You can't just do that because some browsers have that value as a string, e.g. "5px" and some have it as a number.
Try this
window.scroll(0,0) //x-axis, y-axis
If you need it to work in IE and Edge:
document.body.scrollTop = x