Created
September 4, 2013 17:50
-
-
Save gotoplanb/6440348 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- need one for each toplevel nav item. search the demo --> | |
<i data-js="nav-dropdown-trigger" class="icon-caret-down nav-dropdown-trigger"></i> | |
<!-- one of these --> | |
<i data-js="nav-trigger" class="icon-reorder nav-trigger"></i> | |
<!-- put into js --> | |
<script> | |
$(document).ready(function() { | |
/* Mobile navigation dropdown */ | |
$('i[data-js="nav-trigger"]').click(function() { | |
$(this).toggleClass('active'); | |
$('.navPrimary').toggleClass('open'); | |
$('.navPrimary-list-item').removeClass('open'); | |
}); | |
$('i[data-js="nav-dropdown-trigger"]').click(function() { | |
if ($(this).parent('.navPrimary-list-item').hasClass('open')) { | |
$('.navPrimary-list-item').removeClass('open'); | |
} else { | |
$('.navPrimary-list-item').removeClass('open'); | |
$(this).parent().addClass('open'); | |
} | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment