Skip to content

Latest commit

 

History

History

FullScreen

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

全屏

使用方法

import FullScreen from "./fullScreen.js";
const fullScreen = new FullScreen(document.getElementById("xxx"));

btn.onclick = () => {
  fullScreen.toggle();
};

事件监听

import FullScreen from "./fullScreen.js";
const fullScreen = new FullScreen(document.getElementById("xxx"), {
  onEnter() {
    console.log("进入全屏");
  },
  onExit() {
    console.log("退出全屏");
  },
  onChange() {
    console.log("全屏切换事件");
  },
});

btn.onclick = () => {
  fullScreen.toggle();
};

参数列表

参数 介绍 默认值
el(第一个参数) 需要全屏的那个 dom 元素 (必穿参数)
options(第二个参数) 事件传递 {} (空对象)

options 属性

属性 介绍 默认值
onChange 全屏切换事件
onEnter 进入全屏事件
onExit 退出全屏事件

实例方法

方法名 介绍
toggle 全屏切换
enter 进入全屏
exit 退出全屏