Material Design Table with Floating Action Button and Progress Bar
A Pen by prashant dawar on CodePen.
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Material Table</title> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | |
<link rel="stylesheet" href="https://code.getmdl.io/1.2.0/material.indigo-pink.min.css"> | |
<script defer src="https://code.getmdl.io/1.2.0/material.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | |
<link rel="stylesheet" type="text/css" href="./css/tablestyle.css"> | |
</head> | |
<body> | |
<div id="top-container"> | |
<div class="t-container"> | |
<div class="mdl-progress mdl-js-progress mdl-progress__indeterminate p-bar" ></div> | |
<table class="mdl-data-table mdl-js-data-table"> | |
<thead> | |
<tr> | |
<th class="mdl-data-table__cell--non-numeric">Name</th> | |
<th class="mdl-data-table__cell--non-numeric">Nickname</th> | |
<th>Age</th> | |
<th class="mdl-data-table__cell--non-numeric">Living?</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr> | |
<td class="mdl-data-table__cell--non-numeric">John Lennon</td> | |
<td class="mdl-data-table__cell--non-numeric">The smart one</td> | |
<td>40</td> | |
<td class="mdl-data-table__cell--non-numeric">No</td> | |
</tr> | |
<tr> | |
<td class="mdl-data-table__cell--non-numeric">Paul McCartney</td> | |
<td class="mdl-data-table__cell--non-numeric">The cute one</td> | |
<td>73</td> | |
<td class="mdl-data-table__cell--non-numeric">Yes</td> | |
</tr> | |
<tr> | |
<td class="mdl-data-table__cell--non-numeric">George Harrison</td> | |
<td class="mdl-data-table__cell--non-numeric">The shy one</td> | |
<td>58</td> | |
<td class="mdl-data-table__cell--non-numeric">No</td> | |
</tr> | |
<tr> | |
<td class="mdl-data-table__cell--non-numeric">Ringo Starr</td> | |
<td class="mdl-data-table__cell--non-numeric">The funny one</td> | |
<td>74</td> | |
<td class="mdl-data-table__cell--non-numeric">Yes</td> | |
</tr> | |
</tbody> | |
</table> | |
<!-- Colored FAB button --> | |
<button id="item-add" class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-js-ripple-effect mdl-button--colored"> | |
<i class="material-icons" id="add-item">add</i> | |
</button> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
</script> | |
</body> | |
</html> |
Material Design Table with Floating Action Button and Progress Bar.
Discussion of text-align center due to display inline-block in child div :
http://stackoverflow.com/questions/19076919/marginauto-with-inline-block
http://stackoverflow.com/a/9313356/3690154
A Pen by prashant dawar on CodePen.
$(document).ready(function(){ | |
/*============================/For Rate Table Container */ | |
var tableWidth = $('.t-container > table').width(); | |
var pBar = $('.t-container > .p-bar'); | |
pBar.width(tableWidth + 2); | |
/* For Rate Table Container/===========================*/ | |
//=============== [ code to be edited ] | |
var btnItemAdd = $('.t-container > #item-add'); | |
// Selects first child in header row. | |
// Abbr: bml - button margin from left | |
var bml = $('.t-container > table > thead > tr > th:nth-child(1)').width(); | |
// [ end of code to be edited ] ===============/ | |
btnItemAdd.css('left',bml + 16); | |
btnItemAdd.delay( 800 ).fadeIn( 400 ); | |
}); |
#top-container{ | |
text-align: center; | |
} | |
.t-container{ | |
position: relative; | |
display: inline-block; | |
} | |
.t-container > #item-add{ | |
top: 32px; | |
position: absolute; | |
z-index: 1; | |
display: none; | |
} |