Last active
November 6, 2017 23:59
-
-
Save vijaycs85/346c14aedffcafe8945e to your computer and use it in GitHub Desktop.
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
(function ($) { | |
Drupal.behaviors.menuTree = { | |
attach: function (context, settings) { | |
// Set ul depths for better theming. | |
$('#main-menu ul').each(function () { | |
var depth = $(this).parents('ul').length; | |
$(this).addClass('ul-depth-' + depth); | |
}); | |
// Set ul > li depths for better theming. | |
$('#main-menu ul li').each(function () { | |
var depth = $(this).parents('li').length; | |
$(this).addClass('li-depth-' + depth); | |
}); | |
// Set li > a depths for better theming. | |
$('#main-menu ul li a').each(function () { | |
var depth = $(this).parents('ul').length; | |
$(this).addClass('ula-depth-' + depth); | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment