如何啓用「始終顯示」 Chrome中的地址欄在使用Javascript的移動設備上?
換句話說,當用戶向下滾動時不要隱藏。Javascript:始終顯示Chrome地址欄
回答
您可以創建一個div
,將高度設置爲100%
並使用overflow-y:auto;
。
如果您要複製此代碼並將其粘貼到您的項目中,您會看到這是您要查找的內容。
請謹慎使用,我個人喜歡鉻隱藏導航欄。另外,爲了將來,請記住,如果您接受的答案並不能真正回答您的問題,那麼沒有人會放棄它。
例子:
/* 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>
實際上它不。你能解釋這個理論嗎? – Alexander
@Alexander我以前在頁面中使用過這樣的方法,但可能需要稍微調整它,方法是給它一個'margin-top'和較小的高度('calc(100% - margin-top)')。理論是這創造了一個有可滾動內容的盒子,但盒子本身只有頁面本身。因此,'body'不會滾動,也不會觸發標題被摺疊。 – Randy
@亞歷山大您可能會發現這個有用的http://stackoverflow.com/questions/25298443/force-address-bar-to-show-in-mobile-chrome-app – Randy
- 1. 如何隱藏地址欄中顯示的網址(使用javascript)
- 2. UISearch欄始終顯示:沒有結果
- 3. 始終顯示狀態欄和軟鍵
- 4. 隱藏Chrome擴展中地址欄上顯示的圖標
- 5. 當Chrome for iOS地址欄顯示時檢測到
- 6. 地圖工具欄始終顯示在liteMode
- 7. GeoIP始終顯示服務器的IP地址
- 8. Chrome擴展,Javascript:從地址欄獲取網址
- 9. 在Web上顯示地址欄WebBrowser
- 10. 不要在地址欄中顯示URL
- 11. 如何使用WebView顯示地址欄?
- 12. 地址在用PHP地址欄,或javascript
- 13. 谷歌地圖是始終顯示
- 14. 在javascript中顯示帶地址欄的全屏彈出窗口
- 15. 使用Javascript - window.open「位置=無」仍顯示地址欄在Firefox
- 16. Javascript打開新窗口地址欄仍然顯示
- 17. 如何讓地址欄中的地址顯示不同?
- 18. 在地址欄中顯示當前幀的地址
- 19. 地址欄顯示的是上一頁的地址
- 20. IP地址顯示在地址欄而不是域
- 21. 始終顯示Highcharts
- 22. 地址欄始終在移動瀏覽器上可見
- 23. 重定向網址並在地址欄上顯示短網址
- 24. javascript在地址欄中
- 25. 如何讓Chrome重寫地址欄
- 26. 什麼是Google Chrome地址欄字體?
- 27. Chrome擴展程序隱藏地址欄
- 28. 隱藏地址和工具欄在Chrome
- 29. 使用擴展名顯示帶地址欄的Chrome彈出窗口
- 30. 爲什麼在Chrome瀏覽器的地址欄中不顯示圖標文件?
你可以假滾動,但它的棘手。 – gcampbell
你可以用div來包裝你的HTML,將它的高度設置爲100% – 4dgaurav
@thesaurabhway這將如何工作?正如我所看到的,你仍然會得到一個滾動頁面和一個隱藏地址欄 – Alexander