Making the menu affix
The affix plugin is present only in version 3 of Bootstrap (it was removed in version 4), and it aims to toggle the position of an element between fixed and relative, emulating the effect of position: sticky
, which is not present in all browsers.
We will apply the sticky effect the left #profile
element although we do not have enough elements to make a scroll on our web page. Therefore, to make it simple, replicate the <li>
in ul#feed
to increase the number of items in the list. Do this three times or more to make a scroll in your web browser.
In div#profile
, add the markup related to affix:
<div id="profile" class="col-md-3 hidden-sm hidden-xs" data-spy="affix" data-offset-top="0">
…
// rest of the profile HTML
</div>
Refresh ...
Get Bootstrap 4 – Responsive Web Design now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.