Javascript:计算屏幕数量

时间:2014-04-22 06:06:45

标签: javascript html5 web-applications

我们正在开发一个使用4个屏幕的Web应用程序。有没有办法计算屏幕数量?

1 个答案:

答案 0 :(得分:1)

这可能会有所帮助

假设屏幕的矩形排列和所有屏幕具有相同的高度和宽度。

 /// total window width divided by single screen width

var h_screens = Math.round(window.outerWidth / window.screen.availWidth);

 /// total window height divided by single screen height
var v_creens = Math.round(window.outerHeight / window.screen.availHeight);
var total_screens = h_screens * v_creens;
  • ▆▆
       ▆▆

    4 = 2 * 2;