2013-11-21 2 views
1

현재 화면 크기의 너비 80 %의 픽셀 수를 계산하려고합니다. 뭐가 잘못JavaScript 현재 화면 크기의 80 %가 얼마나 많은지 계산합니다.

setInterval(function() { 
     width = (window.innerWidth > 0) ? window.innerWidth : screen.width; 

     var percentWidth = 0.2; 
     var nWidth = (width - percentWidth)/width; 
     nWidth = Math.floor((nWidth * 100)); 


     console.log(nWidth); 
    }, 100); 

어떤 생각을 : 여기

는 내가 지금까지있어 무엇인가? 윈도우 폭

답변

0
var allwidthscreen = screen.width; 

var newwidth = (allwidthscreen * 80)/100; 
관련 문제