Skip to content

Instantly share code, notes, and snippets.

@jackmcdade
Created March 19, 2012 21:50
Show Gist options
  • Select an option

  • Save jackmcdade/2127399 to your computer and use it in GitHub Desktop.

Select an option

Save jackmcdade/2127399 to your computer and use it in GitHub Desktop.
Twitter Bootstrap2 with Structure
{exp:structure:nav max_depth="2" show_depth="2" current_class="active" css_class="nav" has_children_class="dropdown"}
<script>
$(function() {
$('ul li.dropdown').each(function() {
$(this).children('ul').addClass("dropdown-menu"); // add children dropdown menu class
$(this).children('a').append('<b class="caret"></b>') // add caret icon
$(this).clone().prependTo($(this).find('ul')).removeClass('dropdown active').children('ul').remove(); // clone parent link into child menu
$(this).children('a').attr('data-toggle', 'dropdown').attr('href', '#').addClass("dropdown-toggle"); // add data attributes to hook up Bootstrap
});
});
</script>
@interfacecreation

Copy link
Copy Markdown

Sweet, all good after upgrading to Structure 3.2. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment