The question is simple.
How to scroll browser to desired element or desired position by javascript?
Thanks a lot for the help!
To an element :
document.getElementById('id').scrollIntoView();
Has cross browser support and probably the easiest way to do it ....
or to a specific position :
window.scroll(x,y);
//Finds y value of given object
function findPos(obj) {
var curtop = 0;
if (obj.offsetParent) {
do {
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return [curtop];
}
}
//Get object
var SupportDiv = document.getElementById('customer_info');
//Scroll to location of SupportDiv on load
window.scroll(0,findPos(SupportDiv));