Wa. 0811 357 0099 Biaya Kursus Digital Marketing Lombok Barat

Biaya Kursus Digital Marketing Lombok Barat, Kursus Digital Marketing Lombok Barat, Cek Biaya Kursus Digital Marketing Lombok Barat, Belajar Digital Marketing Lombok Barat, Pelatihan Digital…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to Fullscreen a Specific Element in a Web Page

Full control and how to modify styles in a website and web app

Browsers have built-in fullscreen capabilities, which you can access using shortcut keys such as F11 or ⌃⌘F. But it applies to the current page as a whole, what if we want a specific element (such as a game or video) to go fullscreen?

You can do this using the Fullscreen API provided by the browser environment. Not only does it display specific elements fullscreen, but it also allows you to control the style when fullscreen.

To see an example, let’s make a simple HTML first:

For comparison, I made different colors for container and target. Next, bind the listener event for target:

Here I use currentTarget, note that it always points to the element the event is attached to:

Here is the overall demo:

Click on the red area and you can see that only the red area has entered full-screen mode. The API it uses is Element.requestFullscreen(), but it may not work in some browsers due to different implementations like mozRequestFullScreen, webkitRequestFullscreen, etc.

Add a comment

Related posts:

Room Attendant Jobs 2023 In Dubai

Hi friends! Today Best Human Resources Consultancy has announced latest jobs in DUBAI. Now I will provide overall information about Room Attendant Jobs 2023 In Dubai. The management team of Best…

Importance of Community Journalism

While it seems that in the world of journalism, the only news outlets that matter are CNN or Fox News which are the major media organizations. But the truth of it all, is these major organizations…

What are the Remedies for Hives and Eczema on the Lips?

Eczema is a form of dermatitis (inflammation of the skin) that is characterized by rough, scaly, flaky, dry skin with a red appearance. Eczema on the lips (eczematous cheilitis) is referred to simply…