Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id='allBtn'>
  <button id="btn-show-all" type="button" class="btn-flat-border">全部開く</button>
<button id="btn-hide-all" type="button" class="btn-flat-border">全部閉じる</button>
</div>

<table id="ghibuli-table" class='cell-border display' style="width:100%">
  <thead>
    <tr>
      <th></th> 
      <th>作品名</th> 
      <th>公開日</th> 
      <th>監督</th> 
      <th>上映時間 (分)</th> 
    </tr> 
  </thead>
  <tbody>
    <tr>
      <td class='details-control'></td>
      <td>耳をすませば</td>
      <td>1995.7.15</td>
      <td>近藤喜文</td>
      <td>111</td>
      <td>Whisper of the Heart</td>
      <td>柊あおい</td>
      <td>     本名陽子 ⋅ 高橋一生 ⋅ 立花 隆 ⋅ 室井 滋 ⋅ 露口 茂 ⋅ 小林桂樹 </td>
    </tr>
    <tr>
      <td class='details-control'></td>
      <td>魔女の宅急便</td>
      <td>1989.7.29</td>
      <td>宮崎 駿</td>
      <td>102</td>
      <td>Kiki's Delivery Service</td>
      <td>角野栄子</td>
      <td>     高山みなみ ⋅ 佐久間レイ ⋅ 山口勝平 ⋅ 加藤治子 ⋅ 戸田恵子 </td>
    </tr>
    <tr>
      <td class='details-control'></td>
      <td>となりのトトロ</td>
      <td>1988.4.16</td>
      <td>宮崎 駿</td>
      <td>86</td>
      <td>My Neighbor Totoro</td>
      <td>宮崎 駿</td>
      <td>     日高のり子 ⋅ 坂本千夏 ⋅ 糸井重里 ⋅ 島本須美 ⋅ 北林谷栄 ⋅ 高木 均 </td>
    </tr>
    <tr>
      <td class='details-control'></td>
      <td>レッドタートル ある島の物語</td>
      <td>2016.9.17</td>
      <td>マイケル・デュドク・ドゥ・ヴィット</td>
      <td>81</td>
      <td>LA TORTUE ROUGE</td>
      <td>マイケル・デュドク・ドゥ・ヴィット</td>
      <td></td>
    </tr>
    <tr>
      <td class='details-control'></td>
      <td>崖の上のポニョ</td>
      <td>2008.7.19</td>
      <td>宮崎 駿</td>
      <td>101</td>
      <td>Ponyo on the Cliff by the Sea</td>
      <td>宮崎 駿</td>
      <td>     山口智子 ⋅ 長嶋一茂 ⋅ 天海祐希 ⋅ 所ジョージ ⋅ 奈良柚莉愛 ⋅ 土井洋輝 ⋅ 柊 瑠美 ⋅ 矢野顕子 ⋅ 吉行和子 ⋅ 奈良岡朋子 </td>
    </tr>
  </tbody>
</table>
              
            
!

CSS

              
                td.details-control {
  text-align:center;
  width:5%;
  min-width:5%;
  max-width:5%;
}
td.details-control:before {
  font-family: "Font Awesome 5 Free";
  content: "\f0fe";
  font-weight: 900;
  padding: 0px;
  color: #f67280; /*アイコンの色*/
}
tr.shown td.details-control:before {
  font-family: "Font Awesome 5 Free";
  content: "\f146";
  font-weight: 900;
  padding-left: 0px;
  color: #36b5b0; /*アイコンの色*/
}

#allBtn {
  margin: 20px 0px 20px 0px;
  padding-bottom: 20px;
  border-bottom: solid 1px gray ; 
}

.btn-flat-border {
  display: inline-block;
  padding: 0.3em 1em;
  text-decoration: none;
  color: #ff7f7f;
  border: solid 2px #ff7f7f;
  border-radius: 3px;
  transition: .4s;
}

.btn-flat-border:hover {
  background: #ff7f7f;
  color: white;
}
              
            
!

JS

              
                function format ( d ) {
    return '<table style="width:100%;font-size:12px;">'+
        '<tr>'+
            '<td>英語タイトル</td>'+
            '<td>'+d[5]+'</td>'+
        '</tr>'+
        '<tr>'+
            '<td >原作</td>'+
            '<td>'+d[6]+'</td>'+
        '</tr>'+
        '<tr>'+
            '<td>声の出演</td>'+
            '<td>'+d[7]+'</td>'+
        '</tr>'+
    '</table>';
}

$(document).ready(function() {
  var ghibuliTable = $('#ghibuli-table').DataTable({
    searching: false,
    lengthChange: false,
    info: false,
    paging: false,
    columnDefs: [
      // 非表示
      { targets: [5, 6, 7], visible: false }
      ]
  });
  
  $('#ghibuli-table tbody').on('click', 'td.details-control', function () {

    var tr = $(this).closest('tr');
    var row = ghibuliTable.row(tr);
    
    // 行の開閉イベント
    if ( row.child.isShown() ) {
      row.child.hide();
      tr.removeClass('shown');
    } else {
      row.child( format(row.data()) ).show();
      tr.addClass('shown');
    }
  });
  
  // "全部開く" ボタン
  $('#btn-show-all').on('click', function() {
    // Enumerate all rows
    ghibuliTable.rows().every(function() {
      
      if(!this.child.isShown()) {
        this.child(format(this.data())).show();
        $(this.node()).addClass('shown');
        
      }
    });
  });
  
  // "全部閉じる" ボタン
    $('#btn-hide-all').on('click', function() {
      
      ghibuliTable.rows().every(function() {
        
        if(this.child.isShown()) {
          this.child.hide();
          $(this.node()).removeClass('shown');
        }
        
      });
    });
});
              
            
!
999px

Console