问题解答原地址:https://stackoverflow.com/questions/13614112/using-scrollintoview-with-a-fixed-position-header
var node = 'select your element';
var yourHeight = 'height of your fixed header';
// scroll to your element
node.scrollIntoView(true);
// now account for fixed header
var scrolledY = window.scrollY;
if(scrolledY){
window.scroll(0, scrolledY - yourHeight);
}