We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
让当前的元素滚动到浏览器窗口的可视区域内。
element.scrollIntoView(); // 等同于element.scrollIntoView(true) element.scrollIntoView(alignToTop); // Boolean型参数 element.scrollIntoView(scrollIntoViewOptions); // Object型参数
一个Boolean值:
scrollIntoViewOptions: {block: "start", inline: "nearest"}
scrollIntoViewOptions: {block: "end", inline: "nearest"}
一个包含下列属性的Object:
"auto"
"smooth"
"start"
"center"
"end"
"nearest"
"center
nearest"
var element = document.getElementById("box"); element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({block: "end"}); element.scrollIntoView({behavior: "instant", block: "end", inline: "nearest"});
The text was updated successfully, but these errors were encountered:
No branches or pull requests
定义
让当前的元素滚动到浏览器窗口的可视区域内。
语法
参数
alignToTop可选
一个Boolean值:
scrollIntoViewOptions: {block: "start", inline: "nearest"}
。这是这个参数的默认值。scrollIntoViewOptions: {block: "end", inline: "nearest"}
。scrollIntoViewOptions可选
一个包含下列属性的Object:
定义动画过渡效果,
"auto"
或"smooth"
之一。默认为"auto"
。定义垂直方向的对齐,
"start"
,"center"
,"end"
, 或"nearest"
之一。默认为 "end"。定义动画过渡效果,
"auto"
或"smooth"
之一。默认为"auto"
。定义水平方向的对齐,
"start"
,"center
","end"
, 或"nearest"
之一。默认为nearest"
。示例
兼容不支持
The text was updated successfully, but these errors were encountered: