This question already has answers here:
iOS 8 removed “minimal-ui” viewport property, are there other “soft fullscreen” solutions?
                                
                                    (9个答案)
                                
                        
                                2年前关闭。
            
                    
我已经尝试解决其他人所做的事情,
但我仍然无法在iPhone(Safari)中隐藏地址栏。
这是我的代码。

HTML:

<div class="Nav col-xs-12">
</div>
<div class="ScrollBack">
  <div class="Banner col-xs-12">
  </div>
  <div class="Content col-xs-12">
  </div>
</div>


CSS:

.ScrollBack{
    width: 100vw;
    height: 110vh;
    overflow-y:scroll;
}
.Nav{
    background: white;
    height: 6.8vh;
}
.Banner{
    background: green;
    height: 39.4vh;
}
.Content{
    background: blue;
    height: 53.8vh;
}


Javascript:

<script>
    window.addEventListener("load", function() {
        window.scrollTo(0, 1);
     });
</script>


我需要始终在顶部显示div(class ='Nav'),
还是我无法触发scoll事件的问题?

最佳答案

 $(function(){$(window).bind('scroll', function () {}); });


像这样绑定滚动事件。

08-03 14:53