Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navbar collapse problem #13

Open
salinasrh opened this issue Jun 12, 2018 · 4 comments
Open

Navbar collapse problem #13

salinasrh opened this issue Jun 12, 2018 · 4 comments

Comments

@salinasrh
Copy link

Hi,
if I add more than one navbar in the same webpage, when I click on navbar-toggler button, allways display the first navbar content menu.
You can see the problem, even here: https://demos.creative-tim.com/paper-kit-2-pro/docs/1.0/components/navbar.html
Please, can you help me?
Thanks!

@groovemen
Copy link
Contributor

groovemen commented Jun 14, 2018

Hello @salinasrh, thank you for using our products, please set for each .navbar-collapse from the navbars an unique ID e.g. id="navbar" and for each navbar's .navbar-toggler button, set the corresponding attribute with the collapse ID e.g.data-target="#navbar" for each navbar.

<nav class="navbar navbar-expand-lg">
  <div class="container">
    <div class="navbar-wrapper">
      <a class="navbar-brand" href="#pablo">Brand</a>
      <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-bar burger-lines"></span>
        <span class="navbar-toggler-bar burger-lines"></span>
        <span class="navbar-toggler-bar burger-lines"></span>
      </button>
    </div>
    <div class="collapse navbar-collapse justify-content-end" id="navbar">
      <ul class="navbar-nav">
        <li class="nav-item ">
          <a href="register.html" class="nav-link">
           Register
          </a>
        </li>
      </ul>
    </div>
  </div>
</nav>

All the best,
Stefan

@salinasrh
Copy link
Author

salinasrh commented Jun 14, 2018

Hi Stefan,
I applied your suggestion and I still have problems. When viewing the website from a mobile device and clicking on the button to see the menu, I only see the second menu collapse block.
Here is the code:


<nav class="navbar navbar-expand-lg">
        <div class="container">
            <div class="navbar-wrapper">
                <a class="navbar-brand" href="#pablo">Brand 1</a>
                <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbar1" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-bar burger-lines"></span>
                    <span class="navbar-toggler-bar burger-lines"></span>
                    <span class="navbar-toggler-bar burger-lines"></span>
                </button>
            </div>
            <div class="collapse navbar-collapse justify-content-end" id="navbar1">
                <ul class="navbar-nav">
                    <li class="nav-item ">
                        <a href="register.html" class="nav-link">
                            Content 1
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <div class="navbar-wrapper">
                <a class="navbar-brand" href="#pablo">Brand 2</a>
                <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbar2" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-bar burger-lines"></span>
                    <span class="navbar-toggler-bar burger-lines"></span>
                    <span class="navbar-toggler-bar burger-lines"></span>
                </button>
            </div>
            <div class="collapse navbar-collapse justify-content-end" id="navbar2">
                <ul class="navbar-nav">
                    <li class="nav-item ">
                        <a href="register.html" class="nav-link">
                            Content 2
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

Best regards,
Rodrigo.

@salinasrh
Copy link
Author

Hi, any news about using multiple navbars?
I had to delete all navbar .css and .js content to make them work.
Regards,
Rodrigo.

@salinasrh
Copy link
Author

Any update here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants