https://github.com/yangjingyu/vs-full
移动端模拟全屏容器
https://github.com/yangjingyu/vs-full
requestfullscreen
Last synced: 4 months ago
JSON representation
移动端模拟全屏容器
- Host: GitHub
- URL: https://github.com/yangjingyu/vs-full
- Owner: yangjingyu
- License: mit
- Created: 2021-08-09T09:16:12.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-07-07T07:03:24.000Z (almost 4 years ago)
- Last Synced: 2025-08-09T18:42:49.857Z (11 months ago)
- Topics: requestfullscreen
- Language: JavaScript
- Homepage: https://yangjingyu.github.io/vs-full/public/index.html
- Size: 3.98 MB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# full
移动端模拟全屏容器
## 使用
```html
{}
```
```js
import Full from 'vs-full';
const full = new Full({
// 需要全屏的容器
el: document.querySelector('#full'),
// 切换按钮
toggle: document.querySelector('#toggle'),
// 强制旋转
forceRotate: false,
// 自动旋转
autoRotate: false,
// 禁止滑动
disableScroll: true,
});
```
## 参数
- Selector 为 querySelector 选择器 如:'#ID' '.CLASS'
| 参数名 | 描述 | 可选值 | 默认值 |
| ------------- | -------- | --------------------------- | ------ |
| el | 全屏容器 | `HTMLElement` or `Selector` | null |
| toggle | 切换按钮 | `HTMLElement` or `Selector` | null |
| forceRotate | 强制旋转 | `boolean` | false |
| autoRotate | 自动旋转 | `boolean` | false |
| disableScroll | 禁止滑动 | `boolean` | false |
| nativeFirst | 原生优先 | `boolean` | false |
## 事件
| 事件名 | 描述 |
| -------- | -------------- |
| onUpdate | 切换全屏时触发 |
## 方法
| 方法名 | 描述 |
| ----------------- | -------- |
| toggle | 切换全屏 |
| requestFullscreen | 进入全屏 |
| exitFullScreen | 退出全屏 |
| destroy | 销毁 |
## 注意
1. 如果 body 元素为 position:absolute; 请设置根元素的宽高