How do I get the screen size to show when Chrome console is open?

前端 未结 5 1421
花落未央
花落未央 2020-12-28 15:13

I just upgraded to the latest version of Chrome (49.0.2623.87). I\'m noticing a slight feature missing.

If I was inspecting a page with the console open and I resize

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 15:31

    bug fixed in 50 version, but now temporary solution:

    $(document).ready(function() {
        showSize = ShowSize($(window).width(), $(window).height());
        $(window).resize(function() {
            showSize($(window).width(), $(window).height());
        });
    });
    function ShowSize(winW, winH){
        var scrollBarWidth = winH < $(document).find('body') ? 17 : 0; 
        $('body')
            .find(".size-window")
            .remove()
            .end()
            .append('
    '+(winW + scrollBarWidth) +' x '+winH+'
    ') .find(".size-window") .css({ position: 'fixed', right: '10px', top: '10px', color: '#fff', background: 'rgba(0,0,0,0.5)', padding: '5px' }); return function(winW, winH){ scrollBarWidth = winH < $(document).find('body') ? 17 : 0; $('body').find(".size-window").text(winW+ scrollBarWidth +' x '+winH); } }

提交回复
热议问题