<html>
<head>
<html lang="en">
<title>Tab - Tables</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jq-3.3.1/dt-1.10.20/b-1.6.0/b-html5-1.6.0/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/jq-3.3.1/dt-1.10.20/b-1.6.0/b-html5-1.6.0/datatables.min.js"></script>
<script src="./site.js.download"></script>
<!--<script> table.destroy(); </script>-->
<style>div.fw-container {z-index: 1;}</style>
</head>
<body>
<h2>Tabs</h2>
<div class="tab">
<button class="tablinks" onclick="openTab(event, 'Tab1')">Tab 1</button>
<button class="tablinks" onclick="openTab(event, 'Tab2')">Tab 2</button>
<button class="tablinks" onclick="openTab(event, 'Tab3')">Tab 3</button>
<button class="tablinks" onclick="openTab(event, 'Tab4')">Tab 4</button>
<button class="tablinks" onclick="openTab(event, 'Tab5')">Tab 5</button>
</div>
<div id="Tab1" class="tabcontent">
<div class="container">
<div class="unit w-2-3">
<div class="hero-callout">
<div id="sort_table1_wrapper" style="color:#000000" class="dataTables_wrapper">
<div id="sort_table1_filter" class="DataTables_filter"></div>
<div class="DataTables_length" id="sort_table1_length"></div>
<body class="wide hero">
<a name="top"><br></a>
<input type=hidden name="dt_stitle" id="dt_stitle" value="Title 2"/>
</div>
</div>
</div>
</div>
</div>
<div id="Tab2" class="tabcontent">
<div class="container">
<div class="unit w-2-3">
<div class="hero-callout">
<div id="sort_table2_wrapper" style="color:#000000" class="DataTables_wrapper">
<div id="sort_table2_filter" class="DataTables_filter"></div>
<div class="DataTables_length" id="sort_table2_length"></div>
<body class="wide hero">
<a name="top"><br></a>
<input type=hidden name="dt_stitle" id="dt_stitle" value="Title 2"/>
<!--<table id="sort_table2" class="display nowrap DataTable dtr-inline collapsed" style="width: 100%;" role="grid" aria-describedby="sort_table2_info">-->
</div>
</div>
</div>
</div>
</div>
<div id="Tab3" class="tabcontent">
<div class="container">
<div class="unit w-2-3">
<div class="hero-callout">
<div id="sort_table3_wrapper" style="color:#000000" class="DataTables_wrapper">
<div id="sort_table3_filter" class="DataTables_filter"></div>
<div class="DataTables_length" id="sort_table3_length"></div>
<body class="wide hero">
<a name="top"><br></a>
<input type=hidden name="dt_stitle" id="dt_stitle" value="Title 2"/>
<!--<table id="sort_table3" class="display nowrap DataTable dtr-inline collapsed" style="width: 100%;" role="grid" aria-describedby="sort_table3_info">-->
</div>
<div id="Tab4" class="tabcontent">
<div class="container">
<div class="unit w-2-3">
<div class="hero-callout">
<div id="sort_table4_wrapper" style="color:#000000" class="DataTables_wrapper">
<div id="sort_table4_filter" class="DataTables_filter"></div>
<div class="DataTables_length" id="sort_table4_length"></div>
<body class="wide hero">
<a name="top"><br></a>
<input type=hidden name="dt_stitle" id="dt_stitle" value="Title 2"/>
<table id="sort_table4" class="display nowrap DataTable dtr-inline collapsed" style="width: 100%;" role="grid" aria-describedby="sort_table4_info">
</div>
<div id="Tab5" class="tabcontent">
<div class="container">
<div class="unit w-2-3">
<div class="hero-callout">
<div id="sort_table5_wrapper" style="color:#000000" class="DataTables_wrapper">
<div id="sort_table5_filter" class="DataTables_filter"></div>
<div class="DataTables_length" id="sort_table5_length"></div>
<body class="wide hero">
<a name="top"><br></a>
<input type=hidden name="dt_stitle" id="dt_stitle" value="Title 2"/>
<table id="sort_table5" class="display nowrap DataTable dtr-inline collapsed" style="width: 100%;" role="grid" aria-describedby="sort_table5_info">
</div>
</body>
</html>
body {font-family: Arial;}
/* Style the tab */
.tab {
overflow: hidden;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
/* Style the buttons inside the tab */
.tab button {
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 14px 16px;
transition: 0.3s;
font-size: 17px;
}
/* Change background color of buttons on hover */
.tab button:hover {
background-color: #ddd;
}
/* Create an active/current tablink class */
.tab button.active {
background-color: #ccc;
}
/* Style the tab content */
.tabcontent {
display: none;
padding: 6px 12px;
border: 1px solid #ccc;
border-top: none;
}
function openTab(evt, tabName) {
console.log(tabName)
var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
console.log($('#' + tabName).find('table'))
var table = $('#' + tabName).find('table').DataTable();
table.columns.adjust().draw();
};
$(document).ready( function () {
var title;
var table1 = $('#sort_table1')
.addClass( 'nowrap' )
.DataTable( {
//"columns": [{ "width": "10%" }, { "width": "20%" }, { "width": "20%" }, { "width": "20%" }],
responsive: true,
scrollY: 300,
scrollCollapse: true,
search: {"search": ""},
} );
var table2 = $('#sort_table2')
.addClass( 'nowrap' )
.DataTable( {
// "columnDefs": [{ "width": "20%", "targets": 0 }],
responsive: true,
scrollY: 300,
scrollCollapse: true,
search: {"search": ""},
} );
var table3 = $('#sort_table3')
.addClass( 'nowrap' )
.DataTable( {
responsive: true,
scrollY: 300,
scrollCollapse: true,
search: {"search": ""},
} );
var table4 = $('#sort_table4')
.addClass( 'nowrap' )
.DataTable( {
responsive: true,
scrollY: 300,
scrollCollapse: true,
search: {"search": ""},
} );
var table5 = $('#sort_table5')
.addClass( 'nowrap' )
.DataTable( {
responsive: true,
scrollY: 300,
scrollCollapse: true,
search: {"search": ""},
} );
} );
You can jump to the latest bin by adding /latest
to your URL
Shortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + [ | Indents selected lines |
ctrl + ] | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Clone Bin |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |