gpt4 book ai didi

javascript - screen.width 返回错误的大小 javascript android

转载 作者:行者123 更新时间:2023-11-30 03:31:37 24 4
gpt4 key购买 nike

我正在使用 phonegap 编写 1 个应用程序。

我使用 screen.width.height 来获取屏幕宽度和高度。

但是当我测试时,返回错误的值。这是我测试过的一些设备和模拟器:

Samsung galaxy mini 2.3.4 (240x320): return random in (240x301) and (320x401)

Panasonic 102p 2.3.5 (540x960): return random in (0x0) and (320x622) and (540x922)

在 Android 4.0.1 模拟器移动和桌面运行中完美运行

HTC ONE X android 4.1.1 (720x1280): work perfect

经过一些测试,我认为这是错误的,因为android 2。

我试过:

screen.width (height)

screen.availWidth (height)

window.innerWidth (height)

$(window).width() (height)

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="8" />

最佳答案

我使用下一个代码并且运行良好。

var windowWidth = $(window).width();
var windowHeight = $(window).height();

<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="10" />

关于javascript - screen.width 返回错误的大小 javascript android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17357202/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com