jQuery - Accordion Effect on a Table

后端 未结 2 1628
感动是毒
感动是毒 2020-12-05 17:59

I\'m having difficulty implementing an accordion effect on three different tables using jQuery and I could use some assistance. Right now it works o.k. When I click on the h

2条回答
  •  春和景丽
    2020-12-05 18:29

    i added a fade effect. Check it - http://jsfiddle.net/XE6AG/1/

        $(function() {
          $(".research tr:not(.accordion)").hide();
          $(".research tr:first-child").show();
          $(".research tr.accordion").click(function(){
          $(this).nextAll("tr").fadeToggle();
           });
        });
    

    this one is faster - http://jsfiddle.net/XE6AG/2/

        //this is fast
        $(function() {
          $(".research tr:not(.accordion)").hide();
          $(".research tr:first-child").show();
          $(".research tr.accordion").click(function(){
          $(this).nextAll("tr").fadeToggle("fast");
           });
        });
    

    this one is really really slow - http://jsfiddle.net/XE6AG/3/

        //this is fast
        $(function() {
          $(".research tr:not(.accordion)").hide();
          $(".research tr:first-child").show();
          $(".research tr.accordion").click(function(){
          $(this).nextAll("tr").fadeToggle("fast");
           });
        });
    

    you could also add easing to it for example - http://jsfiddle.net/XE6AG/4/.

提交回复
热议问题