HTML DOM
The resize event of the HTMLVideoElement interface fires when one or both of the HTMLVideoElement.videoWidth and HTMLVideoElement.videoHeight properties have just been updated.
This event is not cancelable but may bubble.
Syntax
Use the event name in EventTarget/addEventListener:
addEventListener("resize", (event) => { })
Alternatively, assign to the event handler property of the interface:
onresize = (event) => { }
Event type
A generic Event.
Examples
<video id="media" src="https://example.com/video.mp4"></video>
const el = document.getElementById("media");
el.addEventListener("resize", () => {
console.log("The size of the video element has changed!");
});
Specifications
Browser compatibility
See also
- HTMLVideoElement.videoHeight
- HTMLVideoElement.videoWidth
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
