Subscribe to Youtube channel

How to get/find height and width of window using javascript

By knowing heigth and width of window we can place divs, messages,status wherever we want by using top left property of element. for that you should provide value of top and left to view in different monitors to get dynamic top left position you must find out the window width & height. following code will demostrate you to find out the window width & height which supports in  almost all browsers .


 
function windimension(){
if(window.innerHeight !==undefined)
{
var width= window.innerWidth;
var height=window.innerHeight]; // most browsers
}
else{ // IE varieties
var D= (document.body.clientWidth)? document.body: document.documentElement;
var width= D.clientWidth;
var height=D.clientHeight;
}

}



Hope this will help u.......

Comments

Popular posts from this blog

Implement Logging in CSV file using Nlog in .net core MVC application- part 2

Implement Nlog in .Net core MVC application part 1

Devexpress Datebox date formatting in angular 6 with example

Disable backspace key using Jquery

Angular User Session Timeout example step by step

Restore the lost focus of Auto post back controls in asp.net update Panel control

How to Import CSV File and bind csv file data to gridview in asp.net using c#

Remove Owin from MVC 5 Application and use asp.net custom forms authentication

Clone a generic list in C# using extension method