如何啓用「始終顯示」 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. 當Chrome for iOS地址欄顯示時檢測到
- 3. 隱藏Chrome擴展中地址欄上顯示的圖標
- 4. 始終顯示狀態欄和軟鍵
- 5. UISearch欄始終顯示:沒有結果
- 6. GeoIP始終顯示服務器的IP地址
- 7. 在Web上顯示地址欄WebBrowser
- 8. 在javascript中顯示帶地址欄的全屏彈出窗口
- 9. Javascript打開新窗口地址欄仍然顯示
- 10. 如何讓地址欄中的地址顯示不同?
- 11. 在地址欄中顯示當前幀的地址
- 12. 始終顯示Highcharts
- 13. javascript在地址欄中
- 14. Chrome擴展程序隱藏地址欄
- 15. 如何讓Chrome重寫地址欄
- 16. 什麼是Google Chrome地址欄字體?
- 17. 使用擴展名顯示帶地址欄的Chrome彈出窗口
- 18. 顯示IP地址而不是瀏覽器地址欄中的實際網址
- 19. 用戶的IP地址127.0.0.1始終
- 20. iPhone地址簿始終從默認組
- 21. 始終顯示使用D3js
- 22. .GetChanges始終顯示爲空
- 23. 平均始終顯示3
- 24. UIActivityIndicatorView始終顯示
- 25. FileUpload.HasFile始終顯示爲false
- 26. 始終顯示與iScroll
- 27. 如何始終顯示在
- 28. @QueryParam始終顯示爲空
- 29. 使用Javascript - 格式號碼始終顯示原始小數
- 30. 在地址欄中顯示地圖視圖
你可以假滾動,但它的棘手。 – gcampbell
你可以用div來包裝你的HTML,將它的高度設置爲100% – 4dgaurav
@thesaurabhway這將如何工作?正如我所看到的,你仍然會得到一個滾動頁面和一個隱藏地址欄 – Alexander