Created
July 13, 2012 06:33
-
-
Save joeldbirch/3103140 to your computer and use it in GitHub Desktop.
Add current class to ancestor li elements prior to initialising Superfish
This file contains 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
$(document).ready(function(){ | |
//this will be used more than once so save it to a variable | |
var menu = $('ul.sf-menu') | |
//given that you already seem to have the current page marked with 'current' on the relevant li, | |
//find that li, then find any ancestors of it and add 'current' to them also | |
menu.find('.current').parents('li').addClass('current'); | |
//once you have done that, then initialise Superfish | |
menu.superfish({ | |
pathClass: 'current' | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment