any86 / be-full

🛰 浏览器全屏 / full screen

Home Page:https://any86.github.io/be-full/example/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

be-full NPM Version Size

Full screen display, support PC/mobile, less than 1kb. 🚀Online demo

Language

中文 | English

Install

npm i -S be-full

⚡ quick start

web page full screen
import {beFull} from 'be-full';
beFull();
element fullscreen
const el = document.getElementById('video');
beFull(el);

set css property ":fullscreen"

If there is a "black" gap (or other colors) when the element is full screen, the second parameter can be set to the specified color.

const el = document.getElementById("video");
beFull(el, "#fff");

Note: After executing "exitFull" or "toggleFull", the setting of ":fullscreen" will be automatically canceled.

🔥 API

exitFull(Exit Full Screen)
exitFull();
toggleFull (toggle full screen/exit)

The method of use is the same as beFull, except that the second click will execute exitFull

toggleFull();

// Switch the specified element to full screen/exit
toggleFull(document.getElementById('video'));
isFull (whether the element is full screen)
isFull(document.getElementById('video')); // true or false

About

🛰 浏览器全屏 / full screen

https://any86.github.io/be-full/example/

License:MIT License


Languages

Language:TypeScript 47.6%Language:HTML 31.1%Language:CSS 13.9%Language:JavaScript 7.4%