JS determine the full screen, Jquery dynamic binding element Parent element click event

<!DOCTYPE HTML>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script>
        //兼容IE
        function isFullscreen() {
            return document.fullscreenElement ||
                document.msFullscreenElement ||
                document.mozFullScreenElement || 
                document.webkitFullscreenElement ||  to false ; 
        } 
        the setInterval ( function () { IF (IsFullScreen ()) {the console.log ( ' Fullscreen ' )} the else {the console.log ( ' Not Fullscreen ' )}}, 2000 ); 

        // bind the click event dynamic element parent element 
        setInterval ( function () {
             IF ($ ( ' .on-parent ' )) { 
                $ ( 'parent-.on ' ) .parent (.) OFF ( ' the Click ' ) .click ( function () { 
                    Alert ( ' cyclic Dynamic Element Parent elements bind click event ' ); 
                }) 
            } 
        }, 100 )
         // each browser full-screen change event, IE is not compatible part 
        document.addEventListener ( " fullscreenchange " , function () { 
            console.log ((document.fullscreen) ?  " Full Screen " : " non-full screen " ); 
        }, false);

        document.addEventListener("mozfullscreenchange", function () {
            console.log((document.fullscreen) ? "全屏" : "非全屏");
        }, false);

        document.addEventListener("webkitfullscreenchange", function () {
            console.log((document.fullscreen) ? "全屏" : "非全屏");
        }, false);

        document.addEventListener ( " msfullscreenchange " , function () { 
            the console.log ((document.fullscreen) ?  " Full Screen " : " non-full " ); 
        }, to false ); 

        function appentonParent () { 
            $ ( ' #btnAppentonParent ' ). the After ( ' <div> <the p-> OnParent </ the p-> <the p-class = "ON-parent"> the On </ the p-> </ div> ' ); 
        } 
        // bind the click event dynamic element parent element invalid 
        $ (Document) .on ( 'click', ' .On-parent: Parents ' , function () { 
            Alert ( ' dynamic binding element Parent element click event ' ); 
        }) 
    </ Script > 
    < Video the src = "http://vfx.mtime.cn/Video /2019/02/04/mp4/190204084208765161.mp4 " Controls =" Controls " > 
        browser does not support Video 
    </ Video > 
    < br /> 
    < the Button the above mentioned id =" btnAppentonParent " onclick =" appentonParent () " > 
        additional dynamic element 
    </button>
</body>

</html>

 

Guess you like

Origin www.cnblogs.com/ChenRihe/p/11818358.html