As I have stated in the title, I'm trying to create a horizontal toolbar with affix in Bootstrap. I don't mind if the toolbar is wrapped in a well, a nav or a panel as long as it's horizontal and uses affix.
I'm currently using a well, I have tried with several Bootstrap components and the result is exact the same.
When my toolbar is NOT in "affixed" state it works fine, it has the appropriate width and so forth but when affix kicks in it lose it's width since position: fixed
. As far as I know, elements with fixed position must provide a specific width and that's fine, my problem is that I cannot find an accurate and reliable way of keeping the same width that the toolbar had before being "affixed", which is going to be different with regard to the device resolution.
How could I provide the appropriate width to the "affixed" toolbar? If I don't provide width, the toolbar is too small; if I provide width 100%, the toolbar overflows on the right and some UI elements are missing.
Here is an example that reproduces exact the same problem I'm having: http://www.bootply.com/DAOHegIaTl.
This is the CSS used for the affix:
@media (max-width: 767px) {
#content-library-toolbar.affix
{
top: 100px;
z-index:1;
}
}
@media (min-width: 768px) {
#content-library-toolbar.affix
{
top: 50px;
z-index:1;
}
}