Answer the question
In order to leave comments, you need to log in
Drupal 8, how to enable sticky-top for menu bootstrap theme?
I use Drupal 8 Bootstrap 4 to create a theme. I just started learning twig, drupal b php, before that I only used js and python frameworks, I did something, the problem is that I can’t set up a navbar with the sticky-top class, I don’t want to sticky on top, while fixed works great. Tell me who knows what the problem is and how to solve it.
Perhaps not the right approach, but I have two regions in the navbar for two menus placed at the edges -> primary and secondary, then I work with them separately.
In page.html.twig I output them like this:
<nav class="navbar sticky-top navbar-expand-lg navbar-dark indigo darken-3 clearfix" role="menubar">
{#<a class="navbar-brand" href="#">
<img src="/themes/my-theme/images/logo.svg" class="d-inline-block align-top logo" alt="any Alt">
</a>#}
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarMenu"
aria-controls="navbarMenu" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarMenu" aria-labelledby="Navbar Main Menu">
{{ page.primary_menu }}
<ul class="navbar-nav ml-auto nav-flex-icons">
{{ page.secondary_menu }}
</ul>
</div>
</nav>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question