2013-11-26 15 views
1

當我把固定的div放在頂部,並用css3使用SetTimeout或動畫時,div會改變他的位置。如何在使用setTimeout或動畫css3時使用Phonegap和固定div?

當滾動div更改位置和下降或向上取決於方向滾動的方向。

<html> 
<head> 
<script> 
    cargart(); 
function cargart(){ 
    setTimeout("cargart()",1000); 
    document.getElementById("tmap").innerHTML= new Date(); 
} 
</script> 
<style> 
    #menuindex2{ 
     position:fixed; 
     background-color: #111111; 
     width:100%; 
     height:52px; 
    } 
    #tmap{ 
     position:absolute; 
     margin-top:55px; 

    } 

</style> 
</head> 


<body > 
<div id="menuindex2"> 
    div fixed 
</div> 

<div id="tmap"> 

</div> 

</body> 
</html> 

回答

0

Android,請在您的主文件,設置窗口類型爲「SOFT_INPUT_ADJUST_RESIZE」

@Override 
public void onCreate(Bundle savedInstanceState) 
{ 
    super.onCreate(savedInstanceState); 
    super.loadUrl(Config.getStartUrl(), 1000*60*60*24*7); 
    //getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); 
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 
} 

這將使它所以當顯示的鍵盤,你的頭將仍然固定在網頁視圖調整大小在屏幕的頂部。 ios在config.xml設置中也可以做到這一點。