/ Published in: jQuery
Catches click, if element has nextUntil elements, triggers a slideDown of child elements and returns false (to stop the anchor), if there are no nextUntil elements, does nothing and allows the click through (the anchor works).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$("li.par_cat").click(function() { var el_count = $(this).nextUntil("li.par_cat").size(); if(el_count == 0){ // I'll add something here later. }else{ $(this).nextUntil("li.par_cat").each(function() { $(this).slideToggle("slow"); }); return false; } });