【发布时间】:2016-12-02 11:16:07
【问题描述】:
我是一名年轻的开发人员,他的学校项目在我的学校中风靡一时,然后变成了一个应用程序。我正在使用 Phonegap,因为我在网络语言方面最先进。我决定迎合所有设备,但最初是为 iPhone 布局构建的。为了让它在 iPad 上看起来不错,我使用 Cordova 设备检测来实现我的更改(我知道这很糟糕),如下所示:
//Checks what device is being used
var deviceType = (navigator.userAgent.match(/iPad/i)) == "iPad" ? "iPad" : (navigator.userAgent.match(/iPhone/i)) == "iPhone" ? "iPhone" : (navigator.userAgent.match(/Android/i)) == "Android" ? "Android" : (navigator.userAgent.match(/BlackBerry/i)) == "BlackBerry" ? "BlackBerry" : "null";
//Width & Height for Tannock Image
var width = 178.5;
var height = 270;
//If device is iPad
if(deviceType == "iPad"){
$('#teaImg').css('height', '540px');
$('#teaImg').css('width', '357px');
$('#text1').css('margin-left', '38%');
$('#text1').css("font-size", '35px');
width = 357;
height = 270;
}
当我通过 Xcode 直接将它输入到我的 iPad 时,这个令人震惊的代码工作得非常好,但是当我从应用商店下载它时,它不再工作了,所以它看起来不像我想要的那样,它没有t 应用任何这些更改。
有谁知道如何解决这个问题?
P.s 这个应用叫做 Tannock Tapper,我知道它有问题,我是一个人的团队,学校优先。
【问题讨论】:
-
老兄,这是你的代码吗?那么你忘记以 "}" 结束 if 条件。请更新正确的代码。