Results 1 to 4 of 4

Thread: dropdown link in navbar

  1. #1
    Junior Member
    Join Date
    Apr 2015
    Posts
    4

    Question dropdown link in navbar

    Hi guys

    in the example below it is not possible to go to catalog.html link.
    Is there a way to make this link accessible for navigation?
    I want to make following:
    - clicking on catalog link routes to catalog.html
    - clicking on <span class="caret"> next to catalog link opens dropdown (or hower on li class="dropdown")

    <nav class="navbar navbar-inverse">
    <div class="container-fluid">
    <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand" href="#">WebSiteName</a>
    </div>
    <div class="collapse navbar-collapse" id="myNavbar">
    <ul class="nav navbar-nav">
    <li class="active"><a href="#">Home</a></li>
    <li class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="catalog.html">Catalog <span class="caret"></span></a>
    <ul class="dropdown-menu">
    <li><a href="#">Category 1-1</a></li>
    <li><a href="#">Category 1-2</a></li>
    <li><a href="#">Category 1-3</a></li>
    </ul>
    </li>
    <li><a href="#">Page 2</a></li>
    <li><a href="#">Page 3</a></li>
    </ul>
    <ul class="nav navbar-nav navbar-right">
    <li><a href="#"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
    <li><a href="#"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
    </ul>
    </div>
    </div>
    </nav>

  2. #2
    Junior Member
    Join Date
    Apr 2015
    Location
    Pocatello, ID
    Posts
    2
    I may be missing something obvious here but your href needs an actual link not the default # ie

    Code:
    <li><a href="some_actual_page.html">Category 1-1</a></li>
    Don't believe everything you read on the internet - Albert Einstein
    My Codeivate Profile

  3. #3
    Junior Member
    Join Date
    Apr 2015
    Posts
    4
    if you read my post attentively you will see the real link <a class="dropdown-toggle" data-toggle="dropdown" href="catalog.html">Catalog <span class="caret"></span></a>

  4. #4
    Junior Member
    Join Date
    Apr 2015
    Location
    Pocatello, ID
    Posts
    2
    I am blind so not using CODE tags to wrap your code in doesnt help at all it formats terribly, but I think the short answer is no, there is not a way to do this. Once you place the data-toggle="dropdown" the jquery disables using the href as a link. I could be wrong but I have never used it in this way. Making it a dropdown + actual link will effect your user experience in a bad way, when people see a dropdown caret they usually assume it is a dropdown link not another page + dropdown
    Don't believe everything you read on the internet - Albert Einstein
    My Codeivate Profile

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •