Scroll 在 Phonegap 应用程序中无缘无故地显示自己
Scroll displays itself for no reason in Phonegap app
我正在使用 Phonegap build 构建应用程序。该应用程序只是另一个带有输入字段和 "insert" 按钮的列表应用程序。用户在键入他想要保存的短语并按下按钮以插入值后,该值显示在滚动框中。这是滚动框的代码(HTML、jQuery、CSS):
<script>
$( document ).ready(function() {
center();
});
function center(){
var wh = $(window).height()*0.56;
$('#demo').css({'height':wh+'px'});
}
</script>
<div class="container">
<div class="row">
<div id="demo" align="center" class="col-md-12"></div>
</div>
</div>
<style>
#demo {
overflow: scroll;
padding-left: 30px;
height: 200px;
width: 100%;
}
</style>
#demo 是滚动框所在的地方。我的问题是:
即使我第一次打开应用程序,滚动条也会自行显示。我在很多手机上试过,其中一半有这个问题,而在其他手机上没有出现滚动条。我在网上搜索但找不到类似的问题。你知道我怎样才能让滚动条变得不可见吗?提前致谢。
您是否尝试设置 overflow-x: hidden;
和 overflow-y: auto;
?如果不是尝试像这样使用它
<style>
#demo {
overflow-y: auto;
overflow-x: hidden;
padding-left: 30px;
height: 200px;
width: 100%;
}
</style>
我正在使用 Phonegap build 构建应用程序。该应用程序只是另一个带有输入字段和 "insert" 按钮的列表应用程序。用户在键入他想要保存的短语并按下按钮以插入值后,该值显示在滚动框中。这是滚动框的代码(HTML、jQuery、CSS):
<script>
$( document ).ready(function() {
center();
});
function center(){
var wh = $(window).height()*0.56;
$('#demo').css({'height':wh+'px'});
}
</script>
<div class="container">
<div class="row">
<div id="demo" align="center" class="col-md-12"></div>
</div>
</div>
<style>
#demo {
overflow: scroll;
padding-left: 30px;
height: 200px;
width: 100%;
}
</style>
#demo 是滚动框所在的地方。我的问题是:
即使我第一次打开应用程序,滚动条也会自行显示。我在很多手机上试过,其中一半有这个问题,而在其他手机上没有出现滚动条。我在网上搜索但找不到类似的问题。你知道我怎样才能让滚动条变得不可见吗?提前致谢。
您是否尝试设置 overflow-x: hidden;
和 overflow-y: auto;
?如果不是尝试像这样使用它
<style>
#demo {
overflow-y: auto;
overflow-x: hidden;
padding-left: 30px;
height: 200px;
width: 100%;
}
</style>