Javascript getScreenDimentions


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function getScreenDimentions(){
  2.  
  3. var screenH = screen.height;
  4. var screenW = screen.width;
  5.  
  6. if(document.all){
  7. availW = document.body.clientWidth;
  8. availH = document.body.clientHeight;
  9. } else{
  10. availW = innerWidth; availH = innerHeight;
  11. }
  12.  
  13. var arrScreenDimentions = new Array(); // ALL SIZES ARE WITHOUT 'PX'
  14. arrScreenDimentions[0] = screenH // SCREEN HEIGHT
  15. arrScreenDimentions[1] = screenW // SCREEN WIDTH
  16. arrScreenDimentions[2] = availH // AVAILABLE HEIGHT
  17. arrScreenDimentions[3] = availW // AVAILABLE WIDTH
  18.  
  19. return arrScreenDimentions;
  20. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.