Set div height equal to screen size

后端 未结 6 1621
情深已故
情深已故 2020-11-30 02:10

I have a div element in twitter-bootstrap which will have content that will overflow vertically outside the screen.

I would like the div to take the height of the si

6条回答
  •  囚心锁ツ
    2020-11-30 03:01

    This worked for me JsFiddle

    Html

    ..bootstrap
    
    First Col
    Column-8

    css

    .row {
       background: #f8f9fa;
       margin-top: 20px;
    }
    
     .col {
       border: solid 1px #6c757d;
       padding: 10px;
    }
    

    JavaScript

    var elements = document.getElementsByClassName('window-full');
    var windowheight = window.innerHeight + "px";
    
    fullheight(elements);
    function fullheight(elements) {
        for(let el in elements){
            if(elements.hasOwnProperty(el)){
                elements[el].style.height = windowheight;
            }
        }
    }
    
    window.onresize = function(event){
         fullheight(elements);
    }
    

    Checkout JsFiddle link JsFiddle

提交回复
热议问题