Skip to content

Commit 4116d5c

Browse files
committed
feat: 增加 fullscreenchange 状态监控
1 parent 226d813 commit 4116d5c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/BootstrapBlazor/wwwroot/modules/fullscreen.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1-
import { isElement } from "./utility.js"
1+
import { isElement, registerBootstrapBlazorModule } from "./utility.js"
2+
import EventHandler from "./event-handler.js"
23

34
export async function toggle(options) {
5+
registerBootstrapBlazorModule("FullScreen", null, () => {
6+
EventHandler.on(document, "fullscreenchange", () => {
7+
if (document.fullscreenElement === null) {
8+
[...document.querySelectorAll('.bb-fs-open')].forEach(el => {
9+
el.classList.remove('bb-fs-open');
10+
})
11+
}
12+
});
13+
})
414
let el = null;
515
options = options || {};
616
if (options.id) {

0 commit comments

Comments
 (0)