我按此链接通过使用[Simon mac donald Defination] [1]使用键盘事件.在那种情况下,当键盘隐藏时我显示我的页脚,而当键盘显示时我隐藏我的页脚.是去键盘隐藏功能(所以我的页脚显示)..我不知道为什么..
<script type="text/javascript">
$(document).ready(function ()
{
document.addEventListener("hidekeyboard", onHide, false);
document.addEventListener("showkeyboard", onShow, false);
});
function onHide()
{
$("#footer").show();
}
function onShow()
{
$("#footer").hide();
}
</script>
<style type="text/css">
#footer {
position:absolute;
bottom:0; left:0;
width:100%;
height:7%;
background-color:#00458D;
padding:0;
border-width:3px;
padding-top:3%;
padding-bottom:2%;
padding-right:0px;
padding-left:0px;
background-color:#00458D;
}
#content {
position:absolute; bottom:0;
top:0;
width:100%;
overflow:auto;
}
</style>
</head>
<body >
<div id="content">
<input type="text" style="width=70%">
<br/>
<br/>
<div id="footer" align="center">
<table width=100%>
<input type="image" src="../images/Home.PNG" style="width:23%" onClick="home()"/>
<input type="image" src="../images/messages-menu.jpg" style="width:23%" onClick="inBox()"/>
<input type="image" src="../images/settings-menu.jpg" style="width:23%" onClick="settings()"/>
<input type="image" src="../images/close-menu.png" style="width:23%" onClick="callServiceFunction()"/>
</table>
</div>
</div>
</body>
</html>
解决方法:
删除.ready()函数,并将侦听器添加到deviceready中
<style type="text/css">
#footer {
position:absolute;
bottom:0; left:0;
width:100%;
height:7%;
background-color:#00458D;
padding:0;
border-width:3px;
padding-top:3%;
padding-bottom:2%;
padding-right:0px;
padding-left:0px;
background-color:#00458D;
}
#content {
position:absolute; bottom:0;
top:0;
width:100%;
overflow:auto;
}
</style>
<script type="text/javascript">
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady () {
document.addEventListener("hidekeyboard", onHide, false);
document.addEventListener("showkeyboard", onShow, false);
}
function onHide()
{
$("#footer").show();
}
function onShow()
{
$("#footer").hide();
}
</script>
</head>
<body >
<div id="content">
<input type="text" style="width=70%">
<br/>
<br/>
<div id="footer" align="center">
<table width=100%>
<input type="image" src="../images/Home.PNG" style="width:23%" onClick="home()"/>
<input type="image" src="../images/messages-menu.jpg" style="width:23%" onClick="inBox()"/>
<input type="image" src="../images/settings-menu.jpg" style="width:23%" onClick="settings()"/>
<input type="image" src="../images/close-menu.png" style="width:23%" onClick="callServiceFunction()"/>
</table>
</div>
</div>
</body>
</html>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。