Skip to content Skip to sidebar Skip to footer

Cordova Get Screen Width And Height On 'device Ready' Event

I have a problem to get screen width and height in my Cordova app. I need those values right after the app starts. Right now I'm trying something like this: document.addEventListen

Solution 1:

Simply use jquery function. And should use document.ready instead of deviceready. May be your deviceready running before page load. There is very little difference of timing between deviceready and document.ready.

$(document).ready(function()
{
var height = $(window).height(); 
var width = $(window).width(); 
// do something
});

Post a Comment for "Cordova Get Screen Width And Height On 'device Ready' Event"