Created
June 27, 2011 19:34
-
-
Save jkap/1049621 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
/** | |
Returns the nesting level | |
-1 if not in a ul | |
0 if root | |
>0 if nested | |
*/ | |
function detectNesting(selector, count) { | |
if(!count) { var count = -1; } | |
if ($(selector).parent().is("ul")) | |
{ | |
return detectNesting(selector, count + 1); | |
} | |
return count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment