0

I need some help modifying some bootstap mark up. I have a standard nav bar. My problem is that when I click on the top most li it doesn't follow the link. If I click on any of the sub li they work perfectly.

a short snippet of what my code looks like for one of the links:

<div class="navbar-collapse collapse navHeaderCollapse">
            <ul class="nav navbar-nav ">
              <li><a><img src="images/home.png" alt="home"></a></li>
              <li class="dropdown"><a href="service.html" data-toggle="dropdown" class="dropdown-toggle">Link&nbsp;<b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><a>Sub-Link 1</a></li>
                  <li><a>Sub-Link 1</a></li>
                  <li><a>Sub-Link 1</a></li>
                  <li><a>Sub-Link 1</a></li>
                </ul>
              </li>

If I click on the Link item it doesn't navigate to the service.html page? I've thought of using js to set it's href but that forces me to hard code the link and when all is done this page and the links are going to be generated via a CMS. Is there a way for me to enable the link on the page?

For those asking I have the sub links set to show on hover instead of click

  • You can't modify single bit of html there ? If you can just remove data-toggle="dropdown" class="dropdown-toggle" .. or remove them using jQuery should do it too. – cjmling Apr 10 '17 at 17:30
  • 1
    The purpose of `data-toggle="dropdown" ` is to toggle the dropdown, not navigation. What is the point of showing a dropdown only to navigate away from page? – Carol Skelly Apr 10 '17 at 17:37
  • 1
    @ ZimSystem Yes, I see that now, thank you. If you put your answer to remove the data-toggle = "dropdown" in I'll check it as correct. –  Apr 10 '17 at 17:46

1 Answers1

0

I don't think Bootstrap's dropdown class will allow you to create a link on the dropdown title. You might want to create another navigation for service.html or add it in the dropdown list

Silencer310
  • 862
  • 2
  • 8
  • 25