「sandbox/js/2」の編集履歴(バックアップ)一覧に戻る

sandbox/js/2 - (2019/03/30 (土) 16:10:32) のソース

#html2(){{{{{
<div id="test-style" style="display: none;"><!--
.zeb table
{
  table-layout: fixed;
}
.actdsk table {
  display: table;
  width: 100%;
}
.actdsk table tr:first-child th {
  border: none!important;
  text-align: left;
}
.actdsk table tr:nth-child(n+2)
{
  display: none;
}
--></div>
}}}}}
#js(){{{{{
<script type="text/javascript">
(function() {
  for (var i = 0, root = document.getElementById('test-style'), nodes = root.childNodes; i < nodes.length; i++) {
    if (nodes[i].nodeType === document.COMMENT_NODE) {
      var elem = document.createElement('style');
      elem.type = 'text/css';
      elem.setAttribute('media', 'screen');
      if (elem.styleSheet) elem.styleSheet.cssText = nodes[i].data;
      else elem.appendChild(document.createTextNode(nodes[i].data));
      document.getElementsByTagName('head').item(0).appendChild(elem);
      root.parentNode.removeChild(root);
      break;
    }
  }
})();

$(function() {
  $('.actdsk table tr:first').addClass('collapse');
  $('.actdsk table').on('click', 'tr:first', function(e) {
      let arrow = $(this);
      if (arrow.hasClass('collapse')) {
        arrow.find('fa-chevron-right').removeClass('fa-chevron-right').addClass('fa-chevron-down');
        arrow.removeClass('collapse').addClass('expand');
        $(this).nextAll().show("fast");
      } else {
        arrow.find('fa-chevron-down').removeClass('fa-chevron-down').addClass('fa-chevron-right');
        arrow.removeClass('expand').addClass('collapse');
        $(this).nextAll().hide("fast");
      }
    });
});
</script>
}}}}}