<div class="categorylist level0"> <div class="category"> <a href="http://localhost/moodle/course/category.php?id=3">camp</a> (0) </div> <div class="clearfloat"></div> </div> <div class="categorylist level1"> <div class="category"> <div class="indentation"> <a href="http://localhost/moodle/course/category.php?id=4">ug programs</a> (0) </div> </div> <div class="clearfloat"></div> </div> <div class="categorylist level2"> <div class="category"> <div class="indentation"> <div class="indentation"> <a href="http://localhost/moodle/course/category.php?id=5">BS maths</a> (0) </div> </div> </div> <div class="clearfloat"></div> </div> <div class="categorylist level3"> <div class="category"> <div class="indentation"> <div class="indentation"> <div class="indentation"> <a href="http://localhost/moodle/course/category.php?id=6">BS maths 2011</a> (0) </div> </div> </div> </div> <div class="clearfloat"></div> </div> <div class="categorylist level4"> <div class="category"> <div class="indentation"> <div class="indentation"> <div class="indentation"> <div class="indentation"> <a href="http://localhost/moodle/course/category.php?id=7">spring 2011</a> (0) </div> </div> </div> </div> </div> <div class="clearfloat"></div> </div> <div class="categorylist level0"> <div class="category"> <a href="http://localhost/moodle/course/category.php?id=1">Miscellaneous</a> (2) </div> <div class="clearfloat"></div> </div> <div class="categorylist level0"> <div class="category"> <a href="http://localhost/moodle/course/category.php?id=2">SCME</a> (0) </div> <div class="clearfloat"></div> </div> .
$(document).ready(function() { $categories = $(".categorylist"); for($x=1; $x<=$categories.length; $x++) { $(".categorylist.level"+$x).css("display", "none"); } $(".categorylist").click(function() { $category = $(this).parents(".////categorylist"); $self = $($category).attr("class").split(" ")[1]; $level = parseInt($self.split("")[5]); //if($level < $levels.length){ $next = $level+1; $(".categorylist.level1"+$next).slideToggle(300).siblings("display", "block").slideUp("slow"); return false; }); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)