HTML5 full screen features

Source: Internet
Author: User

HTML5 now supports the full screen feature. The fullscreen API interface is shown below (to make the browser window full screen). See the followingCode:

(1) Full Screen

 
// Find the right method, call on correct elementfunction launchfullscreen (element) {If (element. requestfullscreen) {element. requestfullscreen ();} else if (element. required requestfullscreen) {element. required requestfullscreen ();} else if (element. webkitrequestfullscreen) {element. webkitrequestfullscreen () ;}// launch fullscreen for browsers that support it! Launchfullscreen(document.doc umentelement); // The whole page code must be executed manually before launchfullscreen (document. getelementbyid ("videoelement"); // any individual element

(2) Cancel full screen

// Whack fullscreenfunction cancelfullscreen () {If (document. cancelfullscreen) {document. cancelfullscreen ();} else if (document. mozcancelfullscreen) {document. canccancelfullscreen ();} else if (document. webkitcancelfullscreen) {document. webkitcancelfullscreen () ;}// cancel fullscreen for browsers that support it! Cancelfullscreen ();

(3) full screen attributes and events

    • Document. fullscreenelement: Elements that trigger full screen.
    • Document. fullscreenenabled: Whether the full screen is disabled.

(4) full screen Style

 
/* HTML */:-WebKit-full-screen {Background: pink;}:-moz-full-screen {Background: pink;}/* deeper elements */: -WebKit-full-screen video {width: 100%; Height: 100% ;}

Note: manual triggering is required to trigger full screen. The browser cannot automatically trigger full screen.

 

 

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.