D
D
dibanshee2020-10-15 12:10:44
Drupal
dibanshee, 2020-10-15 12:10:44

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>

Thanks a lot for the advice and help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kabin, 2020-10-16
@Kabin

Have a look at https://www.drupal.org/project/conditional_message it might come in handy. Displays messages via JS
Demo here https://kabanchik.info/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question