【发布时间】:2013-07-02 07:54:21
【问题描述】:
我创建了一个 phonegap 应用程序,但是当它第一次运行时,它不能正常工作。它包含 2 个 jquery 动画,在第一次运行时会遇到一些麻烦。 我认为它的问题与缓存有关。
好的。我的 JavaScript 代码:
$(document).ready(function(){
{
var width=window.innerWidth;
//var id1Width=document.getElementById("Id1").clientWidth;
var myIdWidth=document.getElementById("myId").clientWidth;
width=(width/2)-(myIdWidth/2);
var height1= window.innerHeight;
var idHeight= document.getElementById("myId").clientHeight;
var t=height1;
t= t-document.getElementById("Id1").clientHeight;
height1=(height1/2)-(idHeight/2);
document.getElementById("myId").style.top=height1;
document.getElementById("myId").style.left=width;
var s=document.getElementById("Id1").clientHeight;
//t=height1-2*t;
//$("button").click(function(){
//alert("ddccd");
$("#Id1").animate({top:-height1,height:'0%'},7000);
$("#Id2").animate({top:(1.02*t-height1-(s)),height:'0%'},7000);
//})
}});
【问题讨论】:
-
显示一些代码。显示一些 logcat。帮助我们帮助您。 (请不要使用PhoneGap)
-
@OcuS 而不是 phonegap 对于了解前端语言 HTML CSS JS 的人,您有什么建议。
-
@MatthiasWegtun:开始学习 Java 和 Android,它们很有趣 ;)
-
@vahidkargar:您必须多解释一下“一些麻烦”是什么。现在太模糊了。
-
@OcuS 在第一次运行时,一个图像正确向上,另一图像向下直到从屏幕上隐藏,同时它应该在浏览器中停止在屏幕末尾。