Docs: add popup window demo to sticky header examples

This commit is contained in:
Mottie 2014-11-26 21:22:15 -06:00
parent f9940ac785
commit e93e2b6c8d
4 changed files with 681 additions and 22 deletions

405
docs/css/magnific-popup.css Normal file
View File

@ -0,0 +1,405 @@
/* Magnific Popup CSS */
.mfp-bg {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1042;
overflow: hidden;
position: fixed;
background: #0b0b0b;
opacity: 0.8;
filter: alpha(opacity=80);
}
.mfp-wrap {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1043;
position: fixed;
outline: none !important;
-webkit-backface-visibility: hidden;
}
.mfp-container {
text-align: center;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
padding: 0 8px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.mfp-container:before {
content:'';
display: inline-block;
height: 100%;
vertical-align: middle;
}
.mfp-align-top .mfp-container:before {
display: none;
}
.mfp-content {
position: relative;
display: inline-block;
vertical-align: middle;
margin: 0 auto;
text-align: left;
z-index: 1045;
}
.mfp-inline-holder .mfp-content, .mfp-ajax-holder .mfp-content {
width: 100%;
cursor: auto;
}
.mfp-ajax-cur {
cursor: progress;
}
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
cursor: -moz-zoom-out;
cursor: -webkit-zoom-out;
cursor: zoom-out;
}
.mfp-zoom {
cursor: pointer;
cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
cursor: zoom-in;
}
.mfp-auto-cursor .mfp-content {
cursor: auto;
}
.mfp-close, .mfp-arrow, .mfp-preloader, .mfp-counter {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.mfp-loading.mfp-figure {
display: none;
}
.mfp-hide {
display: none !important;
}
.mfp-preloader {
color: #cccccc;
position: absolute;
top: 50%;
width: auto;
text-align: center;
margin-top: -0.8em;
left: 8px;
right: 8px;
z-index: 1044;
}
.mfp-preloader a {
color: #cccccc;
}
.mfp-preloader a:hover {
color: white;
}
.mfp-s-ready .mfp-preloader {
display: none;
}
.mfp-s-error .mfp-content {
display: none;
}
button.mfp-close, button.mfp-arrow {
overflow: visible;
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none;
display: block;
outline: none;
padding: 0;
z-index: 1046;
-webkit-box-shadow: none;
box-shadow: none;
}
button::-moz-focus-inner {
padding: 0;
border: 0;
}
.mfp-close {
width: 44px;
height: 44px;
line-height: 44px;
position: absolute;
right: 0;
top: 0;
text-decoration: none;
text-align: center;
opacity: 0.65;
filter: alpha(opacity=65);
padding: 0 0 18px 10px;
color: white;
font-style: normal;
font-size: 28px;
font-family: Arial, Baskerville, monospace;
}
.mfp-close:hover, .mfp-close:focus {
opacity: 1;
filter: alpha(opacity=100);
}
.mfp-close:active {
top: 1px;
}
.mfp-close-btn-in .mfp-close {
color: #333333;
}
.mfp-image-holder .mfp-close, .mfp-iframe-holder .mfp-close {
color: white;
right: -6px;
text-align: right;
padding-right: 6px;
width: 100%;
}
.mfp-counter {
position: absolute;
top: 0;
right: 0;
color: #cccccc;
font-size: 12px;
line-height: 18px;
}
.mfp-arrow {
position: absolute;
opacity: 0.65;
filter: alpha(opacity=65);
margin: 0;
top: 50%;
margin-top: -55px;
padding: 0;
width: 90px;
height: 110px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.mfp-arrow:active {
margin-top: -54px;
}
.mfp-arrow:hover, .mfp-arrow:focus {
opacity: 1;
filter: alpha(opacity=100);
}
.mfp-arrow:before, .mfp-arrow:after, .mfp-arrow .mfp-b, .mfp-arrow .mfp-a {
content:'';
display: block;
width: 0;
height: 0;
position: absolute;
left: 0;
top: 0;
margin-top: 35px;
margin-left: 35px;
border: medium inset transparent;
}
.mfp-arrow:after, .mfp-arrow .mfp-a {
border-top-width: 13px;
border-bottom-width: 13px;
top: 8px;
}
.mfp-arrow:before, .mfp-arrow .mfp-b {
border-top-width: 21px;
border-bottom-width: 21px;
opacity: 0.7;
}
.mfp-arrow-left {
left: 0;
}
.mfp-arrow-left:after, .mfp-arrow-left .mfp-a {
border-right: 17px solid white;
margin-left: 31px;
}
.mfp-arrow-left:before, .mfp-arrow-left .mfp-b {
margin-left: 25px;
border-right: 27px solid #3f3f3f;
}
.mfp-arrow-right {
right: 0;
}
.mfp-arrow-right:after, .mfp-arrow-right .mfp-a {
border-left: 17px solid white;
margin-left: 39px;
}
.mfp-arrow-right:before, .mfp-arrow-right .mfp-b {
border-left: 27px solid #3f3f3f;
}
.mfp-iframe-holder {
padding-top: 40px;
padding-bottom: 40px;
}
.mfp-iframe-holder .mfp-content {
line-height: 0;
width: 100%;
max-width: 900px;
}
.mfp-iframe-holder .mfp-close {
top: -40px;
}
.mfp-iframe-scaler {
width: 100%;
height: 0;
overflow: hidden;
padding-top: 56.25%;
}
.mfp-iframe-scaler iframe {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
background: black;
}
/* Main image in popup */
img.mfp-img {
width: auto;
max-width: 100%;
height: auto;
display: block;
line-height: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 40px 0 40px;
margin: 0 auto;
}
/* The shadow behind the image */
.mfp-figure {
line-height: 0;
}
.mfp-figure:after {
content:'';
position: absolute;
left: 0;
top: 40px;
bottom: 40px;
display: block;
right: 0;
width: auto;
height: auto;
z-index: -1;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
background: #444444;
}
.mfp-figure small {
color: #bdbdbd;
display: block;
font-size: 12px;
line-height: 14px;
}
.mfp-figure figure {
margin: 0;
}
.mfp-bottom-bar {
margin-top: -36px;
position: absolute;
top: 100%;
left: 0;
width: 100%;
cursor: auto;
}
.mfp-title {
text-align: left;
line-height: 18px;
color: #f3f3f3;
word-wrap: break-word;
padding-right: 36px;
}
.mfp-image-holder .mfp-content {
max-width: 100%;
}
.mfp-gallery .mfp-image-holder .mfp-figure {
cursor: pointer;
}
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
/**
* Remove all paddings around the image on small screen
*/
.mfp-img-mobile .mfp-image-holder {
padding-left: 0;
padding-right: 0;
}
.mfp-img-mobile img.mfp-img {
padding: 0;
}
.mfp-img-mobile .mfp-figure:after {
top: 0;
bottom: 0;
}
.mfp-img-mobile .mfp-figure small {
display: inline;
margin-left: 5px;
}
.mfp-img-mobile .mfp-bottom-bar {
background: rgba(0, 0, 0, 0.6);
bottom: 0;
margin: 0;
top: auto;
padding: 3px 5px;
position: fixed;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.mfp-img-mobile .mfp-bottom-bar:empty {
padding: 0;
}
.mfp-img-mobile .mfp-counter {
right: 5px;
top: 3px;
}
.mfp-img-mobile .mfp-close {
top: 0;
right: 0;
width: 35px;
height: 35px;
line-height: 35px;
background: rgba(0, 0, 0, 0.6);
position: fixed;
text-align: center;
padding: 0;
}
}
@media all and (max-width: 900px) {
.mfp-arrow {
-webkit-transform: scale(0.75);
transform: scale(0.75);
}
.mfp-arrow-left {
-webkit-transform-origin: 0;
transform-origin: 0;
}
.mfp-arrow-right {
-webkit-transform-origin: 100%;
transform-origin: 100%;
}
.mfp-container {
padding-left: 6px;
padding-right: 6px;
}
}
.mfp-ie7 .mfp-img {
padding: 0;
}
.mfp-ie7 .mfp-bottom-bar {
width: 600px;
left: 50%;
margin-left: -300px;
margin-top: 5px;
padding-bottom: 5px;
}
.mfp-ie7 .mfp-container {
padding: 0;
}
.mfp-ie7 .mfp-content {
padding-top: 44px;
}
.mfp-ie7 .mfp-close {
top: 0;
right: 0;
padding-top: 0;
}

View File

@ -6,14 +6,16 @@
<!-- jQuery --> <!-- jQuery -->
<script src="js/jquery-latest.min.js"></script> <script src="js/jquery-latest.min.js"></script>
<script src="js/jquery-ui-latest.min.js"></script>
<!-- Demo stuff --> <!-- Demo stuff -->
<link rel="stylesheet" href="css/jquery-ui.min.css"> <link rel="stylesheet" href="css/jquery-ui.min.css">
<script src="js/jquery-ui-latest.min.js"></script>
<link rel="stylesheet" href="css/jq.css"> <link rel="stylesheet" href="css/jq.css">
<link href="css/prettify.css" rel="stylesheet"> <link rel="stylesheet" href="css/prettify.css">
<link rel="stylesheet" href="css/magnific-popup.css">
<script src="js/prettify.js"></script> <script src="js/prettify.js"></script>
<script src="js/docs.js"></script> <script src="js/docs.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<!-- Tablesorter: theme --> <!-- Tablesorter: theme -->
<link class="theme" rel="stylesheet" href="../css/theme.default.css"> <link class="theme" rel="stylesheet" href="../css/theme.default.css">
@ -26,12 +28,27 @@
<link class="theme" rel="stylesheet" href="../css/theme.dropbox.css"> <link class="theme" rel="stylesheet" href="../css/theme.dropbox.css">
<link class="theme" rel="stylesheet" href="../css/theme.metro-dark.css"> <link class="theme" rel="stylesheet" href="../css/theme.metro-dark.css">
<style>
#main h3 { margin-top: 20px; }
#main .accordion h3 { margin-top: 0; }
</style>
<style id="css">/* wrapper of table 2 */ <style id="css">/* wrapper of table 2 */
.wrapper { .wrapper {
position: relative; position: relative;
top: 50px; top: 50px;
height: 250px; height: 250px;
overflow-x: auto; overflow-x: auto;
}
/* Magnific popup */
#popup {
position: relative;
background: #FFF;
padding: 20px;
width: auto;
max-width: 500px;
margin: 20px auto;
}</style> }</style>
<!-- Tablesorter script: required --> <!-- Tablesorter script: required -->
@ -41,7 +58,30 @@
<script id="js">$(function(){ <script id="js">$(function(){
$("#table1, .nested, #table3").tablesorter({ $('.open-popup-link').magnificPopup({
type: 'inline',
midClick: true,
callbacks: {
open: function () {
// Will fire when this exact popup is opened
// this - is Magnific Popup object
$('#table0').tablesorter({
theme: 'blue',
headerTemplate : '{content} {icon}', // Add icon for various themes
widgets: ['zebra', 'filter', 'cssStickyHeaders'],
widgetOptions: {
// jQuery selector or object to attach sticky header to
cssStickyHeaders_attachTo: '.mfp-wrap',
stickyHeaders_offset: 0,
// caption set by demo button value
cssStickyHeaders_addCaption: addCaption
}
});
}
}
});
$('#table1, .nested, #table3').tablesorter({
widthFixed : true, widthFixed : true,
headerTemplate: '{content} {icon}', // Add icon for jui theme; new in v2.7! headerTemplate: '{content} {icon}', // Add icon for jui theme; new in v2.7!
@ -58,7 +98,7 @@
}); });
$("#table2").tablesorter({ $('#table2').tablesorter({
widthFixed : true, widthFixed : true,
headerTemplate: '{content} {icon}', // Add icon for jui theme; new in v2.7! headerTemplate: '{content} {icon}', // Add icon for jui theme; new in v2.7!
@ -97,15 +137,18 @@ $(function() {
.addClass('tablesorter-' + (theme === 'black-ice' ? 'blackice' : theme) ); .addClass('tablesorter-' + (theme === 'black-ice' ? 'blackice' : theme) );
}).change(); }).change();
window.addCaption = true;
var addCaption = true;
$('.caption').on('click', function(){ $('.caption').on('click', function(){
addCaption = !addCaption; addCaption = !addCaption;
$(this).html( '' + addCaption ); $(this).html( '' + addCaption );
$('#table1, #table2, #table3, .nested').each(function(){ $('#table0, #table1, #table2, #table3, .nested').each(function(){
this.config.widgetOptions.cssStickyHeaders_addCaption = addCaption; if (this.config) {
this.config.widgetOptions.cssStickyHeaders_addCaption = addCaption;
}
}); });
}); });
}); });
</script> </script>
</head> </head>
@ -128,6 +171,7 @@ $(function() {
<h3><a href="#">Notes</a></h3> <h3><a href="#">Notes</a></h3>
<div> <div>
<ul> <ul>
<li>In <span class="version">v2.18.4</span>, added a <a href="http://dimsemenov.com/plugins/magnific-popup/">Magnific popup</a> example to this page.</li>
<li>In <span class="version">v2.18.1</span>, <code>cssStickyHeaders_addCaption</code> issue fixed &amp; nested tables in IE now work properly.</li> <li>In <span class="version">v2.18.1</span>, <code>cssStickyHeaders_addCaption</code> issue fixed &amp; nested tables in IE now work properly.</li>
<li>This demo uses the CSS Sticky Headers widget which uses <em>CSS transforms</em> to reposition the table head.</li> <li>This demo uses the CSS Sticky Headers widget which uses <em>CSS transforms</em> to reposition the table head.</li>
<li><a href="http://caniuse.com/#search=transform">CSS transforms</a> are supported by most modern browsers (<strong>not IE8 and older</strong>).</li> <li><a href="http://caniuse.com/#search=transform">CSS transforms</a> are supported by most modern browsers (<strong>not IE8 and older</strong>).</li>
@ -191,7 +235,78 @@ $(function() {
<p></p> <p></p>
Include Caption: <button type="button" class="caption">true</button> Include Caption: <button type="button" class="caption">true</button>
<p></p> <p></p>
<h1>Attach sticky header to browser window</h1>
<h3>Sticky headers in a popup window</h3>
<a href="#popup" class="open-popup-link">Show table in Magnific popup window</a>
<div id="popup" class="white-popup mfp-hide">
<table id="table0" class="tablesorter">
<caption>Student Grades</caption>
<thead>
<tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th class="filter-false sorter-false">Geometry</th></tr>
</thead>
<tfoot>
<tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th>Geometry</th></tr>
</tfoot>
<tbody>
<tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td></tr>
<tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
<tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
<tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
<tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr>
<tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
<tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr>
<tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr>
<tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr>
<tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr>
<tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr>
<tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr>
<tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr>
<tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr>
<tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr>
<tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr>
<tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr>
<tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr>
<tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr>
<tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr>
<tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr>
<tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
<tr><td>Student23</td><td>Languages</td><td>female</td><td>85</td><td>80</td><td>80</td><td>80</td></tr>
<tr><td>student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr>
<tr><td>student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr>
<tr><td>student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr>
<tr><td>student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr>
<tr><td>student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr>
<tr><td>student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr>
<tr><td>student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr>
<tr><td>student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr>
<tr><td>student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr>
<tr><td>student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr>
<tr><td>student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr>
<tr><td>student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr>
<tr><td>student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr>
<tr><td>student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr>
<tr><td>student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr>
<tr><td>student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr>
<tr><td>student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr>
<tr><td>student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr>
<tr><td>student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr>
<tr><td>student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr>
<tr><td>student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr>
<tr><td>student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr>
<tr><td>student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr>
<tr><td>student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr>
<tr><td>student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr>
<tr><td>student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr>
<tr><td>student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr>
<tr><td>student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr>
</tbody>
</table>
</div>
<br><br>
<h3>Attach sticky header to browser window</h3>
<table id="table1" class="tablesorter"> <table id="table1" class="tablesorter">
<caption>Student Grades</caption> <caption>Student Grades</caption>
<thead> <thead>
@ -255,7 +370,7 @@ $(function() {
</tbody> </tbody>
</table> </table>
<h1>Attach sticky header to its parent</h1> <h3>Attach sticky header to its parent</h3>
<div class="narrow-block wrapper"> <div class="narrow-block wrapper">
<table id="table2" class="tablesorter"> <table id="table2" class="tablesorter">
<caption>Student Grades</caption> <caption>Student Grades</caption>
@ -282,6 +397,7 @@ $(function() {
</table> </table>
</div> </div>
<h3>Nested sticky header tables</h3>
<table id="table3" class="tablesorter"> <table id="table3" class="tablesorter">
<thead> <thead>
<tr> <tr>

View File

@ -5,15 +5,17 @@
<title>jQuery plugin: Tablesorter 2.0 - Sticky Header Widget</title> <title>jQuery plugin: Tablesorter 2.0 - Sticky Header Widget</title>
<!-- jQuery --> <!-- jQuery -->
<script src="js/jquery-1.4.4.min.js"></script> <script src="js/jquery-latest.min.js"></script>
<script src="js/jquery-ui-latest.min.js"></script> <script src="js/jquery-ui-latest.min.js"></script>
<!-- Demo stuff --> <!-- Demo stuff -->
<link rel="stylesheet" href="css/jq.css"> <link rel="stylesheet" href="css/jq.css">
<link href="css/prettify.css" rel="stylesheet"> <link href="css/prettify.css" rel="stylesheet">
<link rel="stylesheet" href="css/magnific-popup.css">
<link rel="stylesheet" href="css/jquery-ui.min.css"> <link rel="stylesheet" href="css/jquery-ui.min.css">
<script src="js/prettify.js"></script> <script src="js/prettify.js"></script>
<script src="js/docs.js"></script> <script src="js/docs.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<!-- Tablesorter: theme --> <!-- Tablesorter: theme -->
<link class="theme default" rel="stylesheet" href="../css/theme.default.css"> <link class="theme default" rel="stylesheet" href="../css/theme.default.css">
@ -32,24 +34,58 @@
padding: 0 5px; padding: 0 5px;
height: 250px; height: 250px;
overflow-y: auto; overflow-y: auto;
}
/* Magnific popup */
#popup {
position: relative;
background: #FFF;
padding: 20px;
width: auto;
max-width: 500px;
margin: 20px auto;
}
/* Since the popup has a 20px margin, we need to adjust the wrapper position
Note:
this is only required because we aren't actually attaching the sticky header
to the #popup, instead we're attaching it to the .mfp-wrap because that
element scrolls instead of the window
*/
#popup .tablesorter-sticky-wrapper {
margin-left: 20px;
margin-top: -20px;
}</style> }</style>
<!-- Tablesorter script: required --> <!-- Tablesorter script: required -->
<script src="../js/jquery.tablesorter.js"></script> <script src="../js/jquery.tablesorter.js"></script>
<script src="../js/jquery.tablesorter.widgets.js"></script> <script src="../js/jquery.tablesorter.widgets.js"></script>
<script>
$(function(){
$('.options').tablesorter({
widthFixed: true,
widgets: ['stickyHeaders']
});
});
</script>
<script id="js">$(function(){ <script id="js">$(function(){
$("#table1, .nested, #table3").tablesorter({ $('.open-popup-link').magnificPopup({
type: 'inline',
midClick: true,
callbacks: {
open: function () {
// Will fire when this exact popup is opened
// this - is Magnific Popup object
$('#table0').tablesorter({
theme: 'blue',
headerTemplate : '{content} {icon}', // Add icon for various themes
widgets: ['zebra', 'filter', 'stickyHeaders'],
widgetOptions: {
// jQuery selector or object to attach sticky header to
stickyHeaders_attachTo: '.mfp-wrap',
stickyHeaders_offset: 0,
// caption set by demo button value
stickyHeaders_includeCaption: includeCaption
}
});
}
}
});
$('#table1, .nested, #table3').tablesorter({
widthFixed : true, widthFixed : true,
showProcessing: true, showProcessing: true,
headerTemplate : '{content} {icon}', // Add icon for various themes headerTemplate : '{content} {icon}', // Add icon for various themes
@ -91,7 +127,7 @@
}); });
/* make second table scroll within its wrapper */ /* make second table scroll within its wrapper */
$("#table2").tablesorter({ $('#table2').tablesorter({
widthFixed : true, widthFixed : true,
headerTemplate : '{content} {icon}', // Add icon for various themes headerTemplate : '{content} {icon}', // Add icon for various themes
@ -106,6 +142,24 @@
});</script> });</script>
<script> <script>
$(function() { $(function() {
$('.options').tablesorter({
widthFixed: true,
widgets: ['stickyHeaders']
});
window.includeCaption = true;
$('.caption').on('click', function(){
includeCaption = !includeCaption;
$(this).html( '' + includeCaption );
$('#table0, #table1, #table2, #table3, .nested').each(function(){
if (this.config) {
this.config.widgetOptions.stickyHeaders_includeCaption = includeCaption;
this.config.widgetOptions.$sticky.children('caption').toggle(includeCaption);
}
});
});
// removed jQuery UI theme because of the accordion! // removed jQuery UI theme because of the accordion!
$('link.theme').each(function(){ this.disabled = true; }); $('link.theme').each(function(){ this.disabled = true; });
@ -152,6 +206,7 @@ $(function() {
<h3><a href="#">Notes</a></h3> <h3><a href="#">Notes</a></h3>
<div> <div>
<ul> <ul>
<li>In <span class="version">v2.18.4</span>, added a <a href="http://dimsemenov.com/plugins/magnific-popup/">Magnific popup</a> example to this page. <span class="label label-info">Note</span> Please take note of the extra css needed to keep the sticky header aligned.</li>
<li>In <span class="version">v2.18.0</span>, <li>In <span class="version">v2.18.0</span>,
<ul> <ul>
<li>Nested tables with sticky headers now stack properly. See the new example added to the bottom of this demo page.</li> <li>Nested tables with sticky headers now stack properly. See the new example added to the bottom of this demo page.</li>
@ -355,8 +410,81 @@ $(function() {
<h1>Demo</h1> <h1>Demo</h1>
Choose Theme: Choose Theme:
<select></select> <select></select>
<p></p>
Include Caption: <button type="button" class="caption">true</button>
<p></p>
<h3>Sticky headers in a popup window</h3>
<a href="#popup" class="open-popup-link">Show table in Magnific popup window</a>
<div id="popup" class="white-popup mfp-hide">
<table id="table0" class="tablesorter">
<caption>Student Grades</caption>
<thead>
<tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th class="filter-false sorter-false">Geometry</th></tr>
</thead>
<tfoot>
<tr><th>Name</th><th>Major</th><th>Sex</th><th>English</th><th>Japanese</th><th>Calculus</th><th>Geometry</th></tr>
</tfoot>
<tbody>
<tr><td>Student01</td><td>Languages</td><td>male</td><td>80</td><td>70</td><td>75</td><td>80</td></tr>
<tr><td>Student02</td><td>Mathematics</td><td>male</td><td>90</td><td>88</td><td>100</td><td>90</td></tr>
<tr><td>Student03</td><td>Languages</td><td>female</td><td>85</td><td>95</td><td>80</td><td>85</td></tr>
<tr><td>Student04</td><td>Languages</td><td>male</td><td>60</td><td>55</td><td>100</td><td>100</td></tr>
<tr><td>Student05</td><td>Languages</td><td>female</td><td>68</td><td>80</td><td>95</td><td>80</td></tr>
<tr><td>Student06</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
<tr><td>Student07</td><td>Mathematics</td><td>male</td><td>85</td><td>68</td><td>90</td><td>90</td></tr>
<tr><td>Student08</td><td>Languages</td><td>male</td><td>100</td><td>90</td><td>90</td><td>85</td></tr>
<tr><td>Student09</td><td>Mathematics</td><td>male</td><td>80</td><td>50</td><td>65</td><td>75</td></tr>
<tr><td>Student10</td><td>Languages</td><td>male</td><td>85</td><td>100</td><td>100</td><td>90</td></tr>
<tr><td>Student11</td><td>Languages</td><td>male</td><td>86</td><td>85</td><td>100</td><td>100</td></tr>
<tr><td>Student12</td><td>Mathematics</td><td>female</td><td>100</td><td>75</td><td>70</td><td>85</td></tr>
<tr><td>Student13</td><td>Languages</td><td>female</td><td>100</td><td>80</td><td>100</td><td>90</td></tr>
<tr><td>Student14</td><td>Languages</td><td>female</td><td>50</td><td>45</td><td>55</td><td>90</td></tr>
<tr><td>Student15</td><td>Languages</td><td>male</td><td>95</td><td>35</td><td>100</td><td>90</td></tr>
<tr><td>Student16</td><td>Languages</td><td>female</td><td>100</td><td>50</td><td>30</td><td>70</td></tr>
<tr><td>Student17</td><td>Languages</td><td>female</td><td>80</td><td>100</td><td>55</td><td>65</td></tr>
<tr><td>Student18</td><td>Mathematics</td><td>male</td><td>30</td><td>49</td><td>55</td><td>75</td></tr>
<tr><td>Student19</td><td>Languages</td><td>male</td><td>68</td><td>90</td><td>88</td><td>70</td></tr>
<tr><td>Student20</td><td>Mathematics</td><td>male</td><td>40</td><td>45</td><td>40</td><td>80</td></tr>
<tr><td>Student21</td><td>Languages</td><td>male</td><td>50</td><td>45</td><td>100</td><td>100</td></tr>
<tr><td>Student22</td><td>Mathematics</td><td>male</td><td>100</td><td>99</td><td>100</td><td>90</td></tr>
<tr><td>Student23</td><td>Languages</td><td>female</td><td>85</td><td>80</td><td>80</td><td>80</td></tr>
<tr><td>student23</td><td>Mathematics</td><td>male</td><td>82</td><td>77</td><td>0</td><td>79</td></tr>
<tr><td>student24</td><td>Languages</td><td>female</td><td>100</td><td>91</td><td>13</td><td>82</td></tr>
<tr><td>student25</td><td>Mathematics</td><td>male</td><td>22</td><td>96</td><td>82</td><td>53</td></tr>
<tr><td>student26</td><td>Languages</td><td>female</td><td>37</td><td>29</td><td>56</td><td>59</td></tr>
<tr><td>student27</td><td>Mathematics</td><td>male</td><td>86</td><td>82</td><td>69</td><td>23</td></tr>
<tr><td>student28</td><td>Languages</td><td>female</td><td>44</td><td>25</td><td>43</td><td>1</td></tr>
<tr><td>student29</td><td>Mathematics</td><td>male</td><td>77</td><td>47</td><td>22</td><td>38</td></tr>
<tr><td>student30</td><td>Languages</td><td>female</td><td>19</td><td>35</td><td>23</td><td>10</td></tr>
<tr><td>student31</td><td>Mathematics</td><td>male</td><td>90</td><td>27</td><td>17</td><td>50</td></tr>
<tr><td>student32</td><td>Languages</td><td>female</td><td>60</td><td>75</td><td>33</td><td>38</td></tr>
<tr><td>student33</td><td>Mathematics</td><td>male</td><td>4</td><td>31</td><td>37</td><td>15</td></tr>
<tr><td>student34</td><td>Languages</td><td>female</td><td>77</td><td>97</td><td>81</td><td>44</td></tr>
<tr><td>student35</td><td>Mathematics</td><td>male</td><td>5</td><td>81</td><td>51</td><td>95</td></tr>
<tr><td>student36</td><td>Languages</td><td>female</td><td>70</td><td>61</td><td>70</td><td>94</td></tr>
<tr><td>student37</td><td>Mathematics</td><td>male</td><td>60</td><td>3</td><td>61</td><td>84</td></tr>
<tr><td>student38</td><td>Languages</td><td>female</td><td>63</td><td>39</td><td>0</td><td>11</td></tr>
<tr><td>student39</td><td>Mathematics</td><td>male</td><td>50</td><td>46</td><td>32</td><td>38</td></tr>
<tr><td>student40</td><td>Languages</td><td>female</td><td>51</td><td>75</td><td>25</td><td>3</td></tr>
<tr><td>student41</td><td>Mathematics</td><td>male</td><td>43</td><td>34</td><td>28</td><td>78</td></tr>
<tr><td>student42</td><td>Languages</td><td>female</td><td>11</td><td>89</td><td>60</td><td>95</td></tr>
<tr><td>student43</td><td>Mathematics</td><td>male</td><td>48</td><td>92</td><td>18</td><td>88</td></tr>
<tr><td>student44</td><td>Languages</td><td>female</td><td>82</td><td>2</td><td>59</td><td>73</td></tr>
<tr><td>student45</td><td>Mathematics</td><td>male</td><td>91</td><td>73</td><td>37</td><td>39</td></tr>
<tr><td>student46</td><td>Languages</td><td>female</td><td>4</td><td>8</td><td>12</td><td>10</td></tr>
<tr><td>student47</td><td>Mathematics</td><td>male</td><td>89</td><td>10</td><td>6</td><td>11</td></tr>
<tr><td>student48</td><td>Languages</td><td>female</td><td>90</td><td>32</td><td>21</td><td>18</td></tr>
<tr><td>student49</td><td>Mathematics</td><td>male</td><td>42</td><td>49</td><td>49</td><td>72</td></tr>
<tr><td>student50</td><td>Languages</td><td>female</td><td>56</td><td>37</td><td>67</td><td>54</td></tr>
</tbody>
</table>
</div>
<br><br> <br><br>
<h3>Attach sticky header to browser window</h3>
<table id="table1" class="tablesorter"> <table id="table1" class="tablesorter">
<caption class="dark-row">Student Grades</caption> <!-- dark-row used by metro-dark theme to make the header row darker --> <caption class="dark-row">Student Grades</caption> <!-- dark-row used by metro-dark theme to make the header row darker -->
<thead> <thead>
@ -420,6 +548,9 @@ $(function() {
</tbody> </tbody>
</table> </table>
<br>
<h3>Attach sticky header to its parent</h3>
<div class="narrow-block wrapper"> <div class="narrow-block wrapper">
<table id="table2" class="tablesorter"> <table id="table2" class="tablesorter">
<caption class="dark-row">Student Grades</caption> <caption class="dark-row">Student Grades</caption>
@ -446,6 +577,9 @@ $(function() {
</table> </table>
</div> </div>
<br>
<h3>Nested sticky header tables</h3>
<table id="table3" class="tablesorter"> <table id="table3" class="tablesorter">
<thead> <thead>
<tr> <tr>

4
docs/js/jquery.magnific-popup.min.js vendored Normal file

File diff suppressed because one or more lines are too long