How do I collapse a table row in Bootstrap?

前端 未结 6 920
予麋鹿
予麋鹿 2020-12-13 18:29

I am using Bootstrap 2.3.2 in my app and I need to completely hide a row using the collapse plugin. Below is an example:




        
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 18:32

    You just need to set the table cell padding to zero. Here's a jsfiddle (using Bootstrap 2.3.2) with your code slightly modified:

    http://jsfiddle.net/marciowerner/fhjgn7b5/4/

    The javascript is optional and only needed if you want to use a cell padding other than zero.

    $('.collapse').on('show.bs.collapse', function() {
      $(this).parent().removeClass("zeroPadding");
    });
    
    $('.collapse').on('hide.bs.collapse', function() {
      $(this).parent().addClass("zeroPadding");
    });
    .zeroPadding {
      padding: 0 !important;
    }
    
      
      
      
    
    
    
      
    Should be collapsed

提交回复
热议问题