javascript - how to make slidetoggle with jquery? -


i trying use slide-toggle effect of j-query getting issue html have . please take -:

        <li class="active sub-tag">pork ham</li>                                         <li class="active-in active"><a onclick="call_content(146);" href="#">&gt; double smoked ham</a></li>                                                                    <li class="active-in active"><a onclick="call_content(147);" href="#">&gt; prime ham</a></li>                                                                    <li class="active-in active"><a onclick="call_content(148);" href="#">&gt; smoked ham</a></li>            <li class="active sub-tag">pork lyoner</li>                                      <li class="active-in active"><a onclick="call_content(149);" href="#">&gt; pork olive lyoner</a></li>                                                                    <li class="active-in active"><a onclick="call_content(150);" href="#">&gt; pork paprica lyoner</a></li>                                                                  <li class="active-in active"><a onclick="call_content(151);" href="#">&gt; pork pepper lyoner</a></li>                                                                   <li class="active-in active"><a onclick="call_content(152);" href="#">&gt; pork pista lyoner</a></li>                 <li class="active sub-tag">pepperoni</li>                                        <li class="active-in active"><a onclick="call_content(153);" href="#">&gt; pork pepperoni</a></li>    

i want show toggle effect on pork ham , pork lyoner , pepperoni.

advise me how without changing html , classes.

this how did it:

$('.sub-tag').click(function(){     var current = $(this);      while(current.next().hasclass('active-in') != false){         current = current.next();         current.slidetoggle();     } }); 

jsfiddle demo here


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -