Reputation: 41
I am trying to find device's height in Cordova?
pChart.chartHeight = 100;
What can I write instead of 100
? 100
should be the device's height.
Upvotes: 3
Views: 1825
Reputation: 1263
From window.screen
you can obtain its width and height properties, but you should also add the pixel densities since it may change on orientation or among different devices. Try this:
var physicalScreenHeight = window.screen.height * window.devicePixelRatio;
productionChart.chartHeight = physicalScreenHeight;
And have a look here in case you have more doubts.
Upvotes: 2
Reputation: 11
use .resize()
$( window ).resize(function() {
alert($(window).height() + $(window).width);
});
Upvotes: 1
Reputation: 988
Try this.
var w = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var h = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
alert(w +" - "+h);
Upvotes: 0