Element.scrollTo()
语法
element.scrollTo(x-coord, y-coord) element.scrollTo(options)
参数
例子
element.scrollTo(0, 1000);
使用 options
:
element.scrollTo({
top: 100,
left: 100,
behavior: 'smooth'
});
规范
Specification | Status | Comment |
---|---|---|
CSS Object Model (CSSOM) View Module element.scrollTo() |
Working Draft | Initial definition. |
浏览器兼容性
BCD tables only load in the browser