The usage of the JavaScript Fullscreen API for cross-browser
用于跨浏览器使用JavaScript Fullscreen API
npm i el-fullscreen -S
import fullscreen from 'el-fullscreen'
挂载在全局变量 fullscreen 下
<script src="dist/fullscreen.min.js"></script>
window.fullscreen
判断浏览器是否支持全屏
fullscreen.supported()
// true or false
当前处于全屏状态的dom
fullscreen.element()
进入全屏
- el:全屏操作的dom,默认为document.documentElement
fullscreen.launch()
退出全屏
fullscreen.exit()
全屏状态改变事件
- handleChange:事件回调
fullscreen.onChange()