2016-03-11 5 views

risposta

3

bug risolto in 50 versioni, ma una soluzione temporanea ora:

$(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('<div class="size-window">'+(winW + scrollBarWidth) +' x '+winH+'</div>') 
     .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); 
    } 
} 
13

soluzione temporanea:

1- Fare clic destro su html elemento nei tool di sviluppo (elementi)

2- Fare clic all'interno finestra del sito

enter image description here

+1

Ottima soluzione temporanea! Grazie per il consiglio! –

0
function winSize() { 
    console.log(` 
Inner Width: ${this.innerWidth} 
Inner Height: ${this.innerHeight} 
Outer Width: ${this.outerWidth} 
Outer Height: ${this.outerHeight} 
`);} 

winSize(); 

Ogni volta che si desidera controllare le dimensioni della finestra, eseguire winSize(). Si noti che è possibile utilizzare i tasti freccia su/giù nella console per scorrere i comandi utilizzati.

Problemi correlati