Screen size browser window without scroll

0

I would like to know how you can make a page that does not have a scroll and that matches the exact screen size.

How can I do this?

    
asked by anonymous 23.06.2016 / 19:51

1 answer

1

To remove the scroll, hide what is outside with overflow: hidden in CSS, as below:

html,
body {
    overflow: hidden;
    width: 100%
    height: 100%;
}

And if you refer to the size of the screen resolution then just ask the full screen for an element to navigate through the function used in the code below Element Request full screen ). It works with every element, except the natives like "body", etc. It works only with click events and others.

Example:

var btn = document.getElementById("full_screen");

btn.onclick = function() {

        // Seu container para tela cheia
        var page = document.getElementById('page');

        /*
         * É necessário de condições para saber se tem suporte para tela cheia.
         * Não use os operadores ||.
         */
        if(page.requestFullscreen) {
            page.requestFullscreen();
        }else if(page.msRequestFullscreen) {
            /* IE, Edge */
            page.msRequestFullscreen();
        }else if(page.mozRequestFullScreen) {
            /* Firefox */
            page.mozRequestFullScreen();
        }else if(page.webkitRequestFullscreen) {
            /* Chrome, Opera, Safari, etc */
            page.webkitRequestFullscreen();
        }else{
            alert("Sem suporte para tela cheia.");
        }

}
    
23.06.2016 / 20:49