Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stay full screen when trigger upload file?

I'm recently use element.requestFullScreen() to enter full screen mode from my div. However, in my full screen view there's a button could trigger upload file function.

Is it possible for me to force stay in full screen mode while default select file window pop up?

simple demo in steps with jsfiddle 1. click full screen button to full screen mode 2. click file upload input

https://jsfiddle.net/56yzokra/3/

Thanks for reminding me for a simple demo to make it clear

like image 624
WenXuan Lee Avatar asked Nov 07 '22 08:11

WenXuan Lee


1 Answers

I was facing this problem today, and my solution (may be not the best) was to triggers the fullscreen mode on the change event on the input file:

jQuery('#input[type="file"]').change(function(){
                if (!document.fullscreenElement) {
                      var p = document.getElementById('process_container').requestFullscreen()
                      .then(console.log('full'))
                      .catch(error => {
                        console.log(error);
                      });
                  }
            });

When the user selects a file to upload, then the DIV that was on fullscreen at first, is added on fullscreen once again. On my case, the input was on a modal, so the modal keeps open when this happens

like image 63
Marcel Carpinter Avatar answered Nov 14 '22 16:11

Marcel Carpinter