scrollIntoView
要素をビューポートにスクロールします(MDNリファレンス)。
使用法
$(selector).scrollIntoView(scrollIntoViewOptions)
パラメータ
名前 | 型 | 詳細 |
---|---|---|
scrollIntoViewOptions | object , boolean | Element.scrollIntoView() のオプション (デフォルト: { block: 'start', inline: 'nearest' } ) |
例
scrollIntoView.js
it('should demonstrate the scrollIntoView command', async () => {
const elem = await $('#myElement');
// scroll to specific element
await elem.scrollIntoView();
// center element within the viewport
await elem.scrollIntoView({ block: 'center', inline: 'center' });
});