Javascript:总是显示Chrome地址栏

Javascript: always show Chrome address bar

本文关键字:Chrome 地址栏 显示 Javascript      更新时间:2023-09-26

如何使用Javascript在移动设备上启用"always show"地址栏?
换句话说,当用户向下滚动时不要隐藏。

可以创建一个div,设置高度为100%,使用overflow-y:auto;

如果你复制这段代码并粘贴到你的项目中,你会看到这就是你要找的。

请谨慎使用,我个人喜欢chrome隐藏导航栏。

的例子:

/* You NEED to set the container height */
html, body {
  height:100%;
}
/* Then override the scrollbar by a custom scrollable element: */
.customnavigation {
  height:100%;
  overflow-y:auto;
}
<div class="customnavigation">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
  <img src="http://placehold.it/150x150">
</div>