Web Design Tip : How to make the parent link item clickable in Twitter Bootstrap

If you’re using a WordPress theme that takes advantage of the Twitter Bootstrap framework, you may be looking for a way to make changes to the built-in navigation of the framework. By default, when you have a drop down navigational menu, the parent link is clickable, but rather than opening the page that it links to (if you’re using WordPress menus), it displays the sub menu items.

We were recently working on a website design for a client that wanted the parent link to go to the page it was linked to, and to have the drop down menu open on hover, rather than onclick. To accomplish this, we removed the data-toggle=”dropdown” from within the WordPress theme’s functions.php file.

Make sure to remove this line if you see it in a javascript file:

$('.dropdown-toggle').dropdown();

Also, add this to the bootstrap.css file (or wherever your theme has the nav classes) :

ul.nav li.dropdown:hover ul.dropdown-menu{
    display: block; 
    margin: 0   
}

a.menu:after, .dropdown-toggle:after {
  content: none;
}

This makes the parent link item clickable to the destination URL that you set within the WordPress menu if that’s what you’re using to display the navigation menu, and it also displays the dropdown on hover.

Latest from the Lab

What does a website cost in Fort Myers and Naples? Informational $2k to $4k, custom WordPress $4k to $8k, ecommerce $6k to $15k

How Much Does a Website Cost in Fort Myers and Naples?

Real website prices for Southwest Florida small businesses, from $2,000 informational sites to custom
EnterpriseHS.org shown on a desktop browser and a phone

Website Launch: Enterprise High School in Clearwater, FL

The new EnterpriseHS.org answers families’ first questions up front and turns enrolling into four
American Pool Water website shown on a laptop browser and a phone

Making a Splash: A New Brand & Website for American Pool Water

A new logo and website for American Pool Water, a pool water delivery company
blank

Alliant Association Management: New Logo, Brand Identity and Website

A new logo, brand identity and website for Alliant Association Management, an HOA and