Created
April 25, 2015 08:26
-
-
Save crumina/16dcbc415ae184600ad7 to your computer and use it in GitHub Desktop.
Enable accordion deeplinking for Foundation 5
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
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