Get screen visual area

 1 client: function () {

2 if(window.innerWidth !== < span style="color: #0000ff;">null){ // the latest Browser
3 return {
4 "width": window.innerWidth,
5 "height": window.innerHeight
6 }
7 }else if(document.compatMode ==='CSS1Compat'){ // W3C
8 return {
9 "width": document.documentElement.clientWidth,
10 "height": document.documentElement.clientHeight
11 }
12 }
13 return {
14 "width": document.body.clientWidth,
15 "height": document.body.clientHeight
16 }
17 }

1 console.log(window.innerWidth, window.innerHeight);

2 console.log(document.documentElement.clientWidth, document.documentElement .clientHeight);
3 console.log(document.body.clientWidth, document.body.clientHeight);

 1 client: function() {

2 if(window.innerWidth !== < span style="color: #0000ff;">null){ // the latest Browser
3 return {
4 "width": window.innerWidth,
5 "height": window.innerHeight
6 }
7 }else if(document.compatMode ==='CSS1Compat'){ // W3C
8 return {
9 "width": document.documentElement.clientWidth,
10 "height": document.documentElement.clientHeight
11 }
12 }
13 return {
14 "width": document.body.clientWidth,
15 "height": document.body.clientHeight
16 }
17 }

1 console.log(window.innerWidth, window.innerHeight);

2 console.log(document.documentElement.clientWidth, document.documentElement .clientHeight);
3 console.log(document.body.clientWidth, document.body.clientHeight);

Leave a Comment

Your email address will not be published.