How to get height and width after window resize

后端 未结 3 2049
南方客
南方客 2021-01-14 13:10

I have a scorm module which launches in a new window with resizable = 1 in window.open in my js file:

function OpenScormModuleWindow(scormModuleId, scormModu         


        
3条回答
  •  半阙折子戏
    2021-01-14 13:49

    Hope This Example Will Help You...

    HTML Code:

    
    
    
    
    Window Size : height and width
    
    
    
    

    JavaScript Code:

    function getSize()
    {
    var w = document.documentElement.clientWidth;
    var h = document.documentElement.clientHeight;
    
    // put the result into a h1 tag
     document.getElementById('wh').innerHTML = "

    Width: " + w + " Height: " + h + "

    "; }

    Or You Can Also Use Jquery Code For Resize:

    var height = $(window).height();
    var width = $(window).width();
    
    $(window).resize(function() {
    
    var height = $(window).height();
    var width = $(window).width();
    console.log("height"+height);
    console.log("width"+width);
    
    });
    

提交回复
热议问题