Skip to content

Instantly share code, notes, and snippets.

@crumina
Created April 25, 2015 08:26
Show Gist options
  • Save crumina/16dcbc415ae184600ad7 to your computer and use it in GitHub Desktop.
Save crumina/16dcbc415ae184600ad7 to your computer and use it in GitHub Desktop.
Enable accordion deeplinking for Foundation 5
jQuery(document).ready(function () {
setTimeout(function() {
if (window.location.hash) {
jQuery('.accordion dd > a').each(function () {
var current = jQuery(this).parents('.accordion');
var hash = '#' + jQuery(this).attr('href').split('#')[1];
if (hash == window.location.hash) {
current.find('dd').removeClass('active');
current.find('.content').hide();
jQuery(this).parent().addClass('active');
jQuery(this).siblings('.content').show();
}
});
}
}, 100);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment