Live Detect Browser Size - jQuery / JavaScript

前端 未结 6 1339
梦毁少年i
梦毁少年i 2020-12-02 10:46

Is there a jQuery plugin or a way using straight JavaScript to detect browser size.

I\'d prefer it is the results were \'live\', so if the width or height changes, s

6条回答
  •  Happy的楠姐
    2020-12-02 11:27

    you can use

    function onresize (){
       var h = $(window).height(), w= $(window).width();
       $('#resultboxid').html('height= ' + h + ' width: ' w);
    }
     $(window).resize(onresize ); 
    
     onresize ();// first time;
    

    html:

    
    

提交回复
热议问题