--- title: ResizeObserverEntry slug: Web/API/ResizeObserverEntry translation_of: Web/API/ResizeObserverEntry ---
ResizeObserverEntry
接口是传递给{{domxref('ResizeObserver.ResizeObserver','ResizeObserver()')}} 构造器回调函数中的参数对象。
无
无.
以下示例通过观察box的宽度变化从而改变其边框圆角半径。
const resizeOserver = new ResizeObserver(entries => { for (let entry of entries) { entry.target.style.borderRadius = Math.max(0, 250 - entry.contentRect.width) + 'px'; } }); resizeObserver.observe(document.querySelector('.box:nth-child(2)'));
Specification | Status | Comment |
---|---|---|
{{SpecName('Resize Observer','#resize-observer-entry-interface','ResizeObserverEntry')}} | {{Spec2('Resize Observer')}} | Initial definition. |
{{Compat("api.ResizeObserverEntry")}}