Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 29, 2013 09:36 PM by moises.dl
Contributor
2046 Points
628 Posts
Jan 29, 2013 07:53 PM|LINK
I currently have this where i can find the list items with child UL's inside to give them the expand functionality
$(".SiteNavigator > ul > li").each(function () { if ($(this).children("ul").length > 0) { var customStyle = "background-image:URL('global-toggles.gif') ; left:0px;width:30px; display:inline; float:right" $(this).prepend('<div class="toggle-icon" id="inactive-toggle" style="' + customStyle + ' " > </div>') } });
.... my question is ... how do i do this so that i make sure every child in every ul has a expand functionality?? the tree man be "N" levels deep with "N" amount of list items and unordered lists in list items
Jan 29, 2013 09:36 PM|LINK
got it....
function expandChildren(obj) { obj.slideToggle("slow"); obj.children('li').each(function () { expandChildren($(this).children('ul')); }); }
moises.dl
Contributor
2046 Points
628 Posts
recursive loop help
Jan 29, 2013 07:53 PM|LINK
I currently have this where i can find the list items with child UL's inside to give them the expand functionality
$(".SiteNavigator > ul > li").each(function () { if ($(this).children("ul").length > 0) { var customStyle = "background-image:URL('global-toggles.gif') ; left:0px;width:30px; display:inline; float:right" $(this).prepend('<div class="toggle-icon" id="inactive-toggle" style="' + customStyle + ' " > </div>') } });.... my question is ... how do i do this so that i make sure every child in every ul has a expand functionality?? the tree man be "N" levels deep with "N" amount of list items and unordered lists in list items
MOIhawk
moises.dl
Contributor
2046 Points
628 Posts
Re: recursive loop help
Jan 29, 2013 09:36 PM|LINK
got it....
function expandChildren(obj) {
obj.slideToggle("slow");
obj.children('li').each(function () {
expandChildren($(this).children('ul'));
});
}
MOIhawk