Node-webkit Tutorials (12) Full Screen __web

Source: Internet
Author: User
Node-webkit Tutorials (12) fullscreen

Wen/Xuan Soul

Directory

Node-webkit Tutorials (12) fullscreen

Objective

12.1 Three APIs related to fullscreen

Window.enterfullscreen ()

Window.leavefullscreen ()

Window.togglefullscreen ()

11.2 Example

11.3 Summary

Preface

Recently Node-webkit added fullscreen and widow notification APIs, this article mainly demonstrates the effect of the fullscreen API.

12.1 and fullscreen three API Window.enterfullscreen ()

The API brings the entire window into full-screen state. window.leavefullscreen ()

causes the window to exit the full-screen state. window.togglefullscreen ()

reverses the full-screen state of the window. 11.2 Example

New fullscreenhtml and Package.json files.

Fullscreen.html content is as follows:

<title> Soul Test node-webkit full Screen api</title>

<meta charset= "GBK"/>

<body >

<button id= "full" > Fullscreen </button>

<button id= "Exitfull" > Exit fullscreen </button>

<div>

</div>

<script>

var GUI = require (' Nw.gui ');

var win = GUI. Window.get ();

var FULLBT = document.queryselector (' #full ');

Fullbt.addeventlistener ("click", Function (evt) {

Win.enterfullscreen ();

}, False);

var exitbt = document.queryselector (' #exitFull ');

Exitbt.addeventlistener ("click", Function (evt) {

Win.leavefullscreen ();

}, False);

</script>

</body>

Package.json content is as follows:

{

"Name": "Nw-demo",

"Main": "Fullscreen.html",

"Nodejs": true,

"Window": {

"title": "Full Screen API test",

"Toolbar": true,

"width": 300,

"Height": 200,

"Resizable": true,

"Show_in_taskbar": true,

"Frame": true,

"Kiosk": false

},

"WebKit": {

"Plugin": True

}

}

The code is simple, with two button events bound to full screen and exit.

The page starts with the following effects:

When you click Full screen, the effect is as follows:

Click to exit Full screen when the effect is as follows:

11.3 Summary

This article mainly refers to the official English document of Node-webkit, and makes the appropriate adjustment (Https://github.com/rogerwang/node-webkit/wiki/Window). despise does not indicate the source of the reprint, more relevant content, welcome to visit the Xuan Soul of the blog (www.xuanhun521.com)

For more information, please visit Xuan Soul's blog ( more Node-webkit related content http://www.xuanhun521.com/Blog/Tag/node-webkit)

PS: Readers interested in this article, can add QQ Group: hacking:303242737; Hacking-2 Group: 147098303;hacking-3 Group: 31371755;hacking-4 Group: 201891680; HACKING-5 Group: 316885176

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.