Skip to main content

overlay with youtube video - simple

It's very simple but I didn't spent too much time.

you just need to add your image with x.png



paste the js or include it in an external .js file.


JS


<script>
$(document).ready(function(){


var overlay = jQuery('<div id="overlay"></div><div id="box" class="videoWrapper"><iframe src="https://www.youtube.com/embed/B-HCMfaOkL0?autoplay=1&rel=0&enable_js=1" frameborder="0" allowfullscreen></iframe></div><div id="closebox"><img src="images/x.png" /></div>');
overlay.appendTo(document.body).fadeIn('fast');

    $("#box").width($(window).width());
    $("#box").height($(window).height());
    $("#box").css('width','90%');
    $("#box").css('margin-left','5%');
    $("#box").css('margin-right','5%');
   
     $("#closebox").click(
     function(){
         $('#overlay').fadeOut('fast');
         $('.videoWrapper iframe').attr('src', '');
         $('#box').hide();
         $('#closebox').hide();
     });

     //chiusura emergenza
     $('#overlay').click(
     function(){
        $(this).fadeOut('fast');
        $('.videoWrapper iframe').attr('src', '');
        $('#box').hide();
        $('#closebox').hide();
     });
   
     $(document).on('keyup',function(evt) {
        if (evt.keyCode == 27) {
             $('#overlay').fadeOut('fast');
             $('#box').hide();
        }
    });
});

$(window).resize(function(){
    $("#box").width($(window).width());
    $("#box").height($(window).height());
    $("#box").css('width','90%');
    $("#box").css('margin-left','5%');
    $("#box").css('margin-right','5%');
});

</script>



and add a bit of css

CSS

#overlay {position: fixed;top: 0;left: 0;width: 100%;height: 100%;background-color: #000;opacity: .7; filter: alpha(opacity=70);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";z-index: 10000;}
#box{ width:90%; height:90%; display:none;position:absolute; left:0%; top:0%;z-index: 10001;}
#box iframe{width:100%;height:100%}
#closebox{ position: fixed; top: 0px;right: 0px;z-index: 10001;padding:4px;}

Comments

Popular posts from this blog

Moodle 3.8.1+ - path leak via errors in several files

Moodle 3.8.1+ ----------------------------------------------- File: admin/mailout-debugger.php #!/usr/bin/php Notice : Disabled. in \admin\mailout-debugger.php on line 73 File: admin/settings/appearance.php Notice : Undefined variable: hassiteconfig in \admin\settings\appearance.php on line 10 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\appearance.php:10 Stack trace: #0 {main} thrown in \admin\settings\appearance.php on line 10 File: admin/settings/badges.php Notice : Undefined variable: hassiteconfig in \admin\settings\badges.php on line 30 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\badges.php:30 Stack trace: #0 {main} thrown in \admin\settings\badges.php on line 30 File: admin/settings/courses.php Notice : Undefined variable: hassiteconfig in \admin\settings\courses.php on line 32 Fatal error : Uncaught Error: Call to undefined function

2022 - Remove (the too many) Ads from Memu launcher

Simple method Download from pureapk "MEmu Launcher2" ex: MEmu Launcher2_v6.0.9_apkpure.com Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar) Longer method Install "Export Apk" Export the memu launcher2  Install purify https://github.com/echo-devim/purify/raw/master/Purify.apk use purify with the exported memu launcher 2 Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar)