2016-08-16 4 views
4

有効にするJavascriptを使用して携帯端末でChromeのアドレスバーを「」に常に表示しますか?
つまり、ユーザーにスクロールしたときに非表示にしないでください。Javascript:常にChromeのアドレスバーを表示

+1

あなたは偽のスクロールをできたが、それは難しいです。 – gcampbell

+0

divを高さに設定してHTMLを折り返すことができます。100% – 4dgaurav

+0

@thesaurabhwayどのように動作しますか?私が見ているように、スクロールしているページと隠れているアドレスバーが表示されます – Alexander

答えて

1

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>

+0

実際には表示されません。理論を説明できますか? – Alexander

+1

@Alexander私はこれまで私のページにこのような方法を使っていましたが、マージントップとそれ以下の高さ( 'calc(100% - マージントップ)')を与えて少し調整する必要があります。理論では、スクロール可能なコンテンツを持つボックスが作成されますが、ボックス自体はページ自体の高さにすぎません。したがって、 'body'はスクロールせず、ヘッダーが折りたたまれてトリガーされません。 – Randy

+0

@Alexanderこれは便利なことでしょう。http://stackoverflow.com/questions/25298443/force-address-bar-to-show-in-mobile-chrome-app – Randy

関連する問題