2012-11-13 35 views
0

我正在開發一個帶有phonegap的android手機應用程序。 在主菜單中,我有4個圖像,點擊圖像時,它將用戶重定向到另一個頁面。 我想要的是應用程序要記住用戶在第一次打開應用程序時第一次選擇的內容,因此當他第二次執行應用程序時,應用程序應直接打開第一次選擇的頁面。android phonegap在第二次啓動時跳過主頁

我的,我想在應用程序的第二個午餐要跳過第一頁看起來像這樣:

<!DOCTYPE html> 

<html> 
<head> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<script src="res/jquery.js"></script> 
<script> 
$(document).ready(function() { 
    $("img.imgnavbar").animate({ 
    opacity: 1.0, 
    }, 800); 
}); 
</script> 
<style type="text/css"> 
     body{background-color:black; background-repeat:no-repeat; position:absolute;} 
        img.imgnavbar{height:auto; width:48%; opacity: 0.0;} 
     .menu{padding-top:55%;} 
        img.shadow{height:auto; width:100%; bottom:0px; position:fixed; left:0%; z-index:-1;} 
        img.choose{height:auto; width:100%; top:0px; position:absolute; z-index:-1;} 

       </style> 
</head> 
<body> 
<div align="center" class="menu"> 
<img src='img/cosmote4.png' id="cosmote" class="imgnavbar" value="1"/> 
<img src='img/germanos2.png' id="germanos" class="imgnavbar" value="2"/> 
<img src='img/zapp2.png' id="zapp" class="imgnavbar" value="3"/> 
<img src='img/sunlight4.png' id="sunlight" class="imgnavbar" value="4"/> 
</div> 
<img src='img/choose.png' id="choose" class="choose"/> 
<img src='img/shadow.png' id="shadow" class="shadow"/> 


<script> 
$("img.imgnavbar").click(function(){ 
       if (confirm('Are you sure you choose this company?')) { 
       $("img.imgnavbar").animate({ 
    opacity: 0.0, 
    }, 800); 

    switch ($(this).attr('src')) { 

     case "img/cosmote4.png": 
      $("img.choose").animate({"top": "-=60%"}, "slow"); 
           $("img.shadow").animate({"bottom": "-=100%"}, "slow"); 
               setInterval(function(){window.location.replace("cosmote.html"); 
},800); 
      break; 

     case "img/germanos2.png": 
      $("img.choose").animate({"top": "-=60%"}, "slow"); 
           $("img.shadow").animate({"bottom": "-=100%"}, "slow"); 
               setInterval(function(){window.location.replace("germanos.html"); 
},800); 
      break; 

     case "img/zapp2.png": 
      $("img.choose").animate({"top": "-=60%"}, "slow"); 
           $("img.shadow").animate({"bottom": "-=100%"}, "slow"); 
               setInterval(function(){window.location.replace("zapp.html"); 
},800); 
      break; 

     case "img/sunlight4.png": 
      $("img.choose").animate({"top": "-=60%"}, "slow"); 
           $("img.shadow").animate({"bottom": "-=100%"}, "slow"); 
               setInterval(function(){window.location.replace("sunlight.html"); 
},800); 
      break; 
    } 
} 
else{} 
}); 
</script> 



</body> 

</html> 

Thanks! 

回答

相關問題