I'm trying to add an alert to my website which sticks to the bottom of my screen and scrolls when scrolling with the website. I have built my website with bootstrap so am using the bootstrap framework. I was informed that the affix would allow for the alert to be scrollable on the website but it is not. We are using codeignitor so we load views and the alert is one of the views which is loaded.
I have attempted to follow the steps here: https://www.w3schools.com/bootstrap/bootstrap_affix.asp and here: Bootstrap, keep div fixed after scrolling to it but to no avail.
It has the following content.
<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>
with the following css code:
.alert {
position: fixed;
.affix{top:50px;
}
I have attempted to change this to:
<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>
With the following css code
.alert {
position: fixed;
}
.affix {
top:50px;
position:fixed;
}
But when doing so the alert completely falls off the screen. Could someone please give me a pointer to this?