我已经在桌面上工作,但手机上没有。当人向上滚动并卡在页面底部时,该栏应该出现。
http://54.200.76.33:8080/
在像safari这样的移动浏览器上,条形图一直持续到动量停止。我正在阅读当用户滚动网页时,javascript被禁用,因此无法捕捉到该事件。
我在这里阅读Google教程https://developers.google.com/mobile/articles/webapp_fixed_ui
但我仍然认为这不能解决我的问题。未来是否有修复移动浏览器的计划?有没有办法解决这个问题?
<script type="text/javascript">//<![CDATA[
/*THIS WORKS FINE ON DESKTOP BROWSERS*/
/*Needs to work on mobile browsers*/
$(window).load(function(){
var foundTop = $('.found').offset().top;
$(window).scroll(function () {
var currentScroll = $(window).scrollTop();
if (currentScroll >= 40) {
$('.found').css({
position: 'fixed',
bottom: '0',
left: '0'
});
} else {
$('.found').css({
position: 'absolute',
bottom: '-40px',
});
}
});
});//]]>
</script>
答案 0 :(得分:1)
有一个css修复: 您使用过:
style="position: absolute; bottom: -40px; left: 0px;"
对于固定定位的页脚,请使用以下css:
style="position: fixed; -webkit-backface-visibility:hidden; bottom: -40px; left: 0px;"
并修正了javascript:
<script type="text/javascript">//<![CDATA[
/*THIS WORKS FINE ON DESKTOP BROWSERS*/
/*Needs to work on mobile browsers*/
$(window).load(function(){
var foundTop = $('.found').offset().top;
$(window).scroll(function () {
var currentScroll = $(window).scrollTop();
if (currentScroll >= 40) {
$('.found').css({
bottom: '0',
left: '0'
});
} else {
$('.found').css({
bottom: '-40px'
});
}
});
});//]]>
答案 1 :(得分:1)
您好Zeus您可以提供您的代码,然后很容易理解问题的确切位置。 这意味着我在这里提供滚动视图的链接。
表示垂直滚动视图:
http://www.androidhub4you.com/2013/05/simple-scroll-view-example-in-android.html
表示水平滚动视图: