• html5 API 全屏


    /* example
    *
    *	var id = document.querySelector('.needFullDom');
        id.onclick = function() {
        	window.fullScreenApi.supportsFullScreen && fullScreenApi.requestFullScreen(id);
        }
    *
    */
    (function(){
        var fullScreenApi = {
                supportsFullScreen: false,
                isFullScreen: function() { return false; },
                requestFullScreen: function() {},
                cancelFullScreen: function() {},
                fullScreenEventName: '',
                prefix: ''
            },
            browserPrefixes = 'webkit moz o ms khtml'.split(' ');
        // check for native support
        if (typeof document.cancelFullScreen != 'undefined') {
            fullScreenApi.supportsFullScreen = true;
        } else {
            // check for fullscreen support by vendor prefix
            for (var i = 0, il = browserPrefixes.length; i < il; i++ ) {
                fullScreenApi.prefix = browserPrefixes[i];
                if (typeof document[fullScreenApi.prefix + 'CancelFullScreen' ] != 'undefined' ) {
                    fullScreenApi.supportsFullScreen = true;
                    break;
                }
            }
        }
        // update methods to do something useful
        if (fullScreenApi.supportsFullScreen) {
            fullScreenApi.fullScreenEventName = fullScreenApi.prefix + 'fullscreenchange';
            fullScreenApi.isFullScreen = function() {
                switch (this.prefix) {
                    case '':
                        return document.fullScreen;
                    case 'webkit':
                        return document.webkitIsFullScreen;
                    default:
                        return document[this.prefix + 'FullScreen'];
                }
            }
            fullScreenApi.requestFullScreen = function(el) {
                return (this.prefix === '') ? el.requestFullScreen() : el[this.prefix + 'RequestFullScreen']();
            }
            fullScreenApi.cancelFullScreen = function(el) {
                return (this.prefix === '') ? document.cancelFullScreen() : document[this.prefix + 'CancelFullScreen']();
            }
        }
        // jQuery plugin
        if (typeof jQuery != 'undefined') {
            jQuery.fn.requestFullScreen = function() {
                return this.each(function() {
                    if (fullScreenApi.supportsFullScreen) {
                        fullScreenApi.requestFullScreen(this);
                    }
                });
            };
        }
        window.fullScreenApi = fullScreenApi;
    })();
    

      

  • 相关阅读:
    dubbo zookeeper报错failed to connect to server , error message is:No route to host
    linux的ssh命令
    linux的/etc/hosts的作用
    linux如何查看某个pid的进程?
    Nginx配置详解
    nginx基本配置与参数说明以及Nginx中的upstream轮询机制介绍
    Nginx配置upstream实现负载均衡
    nginx简单的nginx.conf配置
    API Gateway性能比较:NGINX vs. ZUUL vs.Cloud Gateway vs. Linkerd[译]
    RabbitMQ 入门【精+转】
  • 原文地址:https://www.cnblogs.com/zhoulingfeng/p/3418044.html
Copyright © 2020-2023  润新知