ウェブサイトにスクロールするときに、画面の下部にこだわるアラートを追加しようとしています。私はブートストラップで自分のウェブサイトを構築しているので、ブートストラップフレームワークを使用しています。私は、接辞がウェブサイト上で警告をスクロール可能にすることができると通知されましたが、そうではありません。私たちはビューをロードするようにcodeignitorを使用しています。アラートはロードされたビューの1つです。サイトに貼られたままのdivを作成する
私はここの手順に従うことを試みた:https://www.w3schools.com/bootstrap/bootstrap_affix.asp 、ここで:Bootstrap, keep div fixed after scrolling to it が、無駄に。
以下の内容が含まれています。私はこれを変更しようと試みてきた
.alert {
position: fixed;
.affix{top:50px;
}
::次のCSSコードで
<div class="alert alert-danger alert-dismissable data-spy="affix"">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Bear With Us!</strong> We're currently building the site so expect some bugs!
</div>
次のCSSコード
.alert {
position: fixed;
}
.affix {
top:50px;
position:fixed;
}
しかしで
<div data-spy="affix" data-offset-top="50">
<div class="alert alert-danger alert-dismissable">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Bear With Us!</strong> We're currently building the site so expect some bugs!
</div>
</div>
やっアラートは完全に下がります画面に表示されます。誰かが私にこのポインタを教えてくれますか?
を下にスクロールすることができ感謝しています私のコードでは機能しませんでしたが、私がインデックスで行っていることは、 <?php です。 0 $ this-> load-> view( 'header'、['map' => true]); \t $ this-> load-> view( 'thumbnails'); \t $ this-> load-> view( 'alert'); \t $ this-> load-> view( 'about'); \t $ this-> load-> view( 'contact'); \t $ this-> load-> view( 'search'); ? コードを含むビューで警告が表示されるため、サムネイルとアラートの間のビューの下部に表示されるのではなく、コードニード/ MVCの問題と思われます、 確信はないけど – PKGrem