Posted By

daulex on 02/19/10


Tagged

jquery 14


Versions (?)

jQuery find li elements until, if has nextUntil elements


 / 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).

  1. $("li.par_cat").click(function() {
  2. var el_count = $(this).nextUntil("li.par_cat").size();
  3. if(el_count == 0){
  4. // I'll add something here later.
  5. }else{
  6. $(this).nextUntil("li.par_cat").each(function() {
  7. $(this).slideToggle("slow");
  8. });
  9. return false;
  10. }
  11. });

Report this snippet  

You need to login to post a comment.