jqueryexample.com jquery- get the screen width/height of client browser - jqueryexample.com

jquery- get the screen width/height of client browser by jqueryexample

In webpages we need to format the images text differently according to the screen resolution of the user.
Below is code to detect browser width and  height. You can write your code according the condition.

To get screen width or height use function:

var winHeight = $(window).height();
var winWidth  = $(window).width();

$(document).ready(function() {
if ((screen.width>=1024) && (screen.height>=768)) {
// statement
}
else  {
//statement
}
});

$(document).ready(function() {
$(window).resize(function() {
if ($(window).height() < 800) {
//statement
}
else {
//statement
}
});
});

Did you like this? Share it:

Discussion

No comments yet, be the first.

Leave a Comment