Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <html>
  <head><title>Shared cM Project</title>
  </head>
  <body>
  <h1>The Shared cM Project &#8211; Version 3.0</h1>
  <div class="meta-left">
    <h2>August 2017</h2>
    <p>Blaine T. Bettinger</p>
    <p>www.thegeneticgenealogist.com</p>
     <p><a target="background" href="http://www.thegeneticgenealogist.com/2015/05/29/the-shared-cm-project/">More about this project</a></p>
    <p><a target="license" href="https://creativecommons.org/licenses/by/4.0/">CC 4.0 Attribution License</a></p>
      <p>Interactive version by Jonny Perl at <a target="dnapainter" href="/">DNA Painter</a>

  
  </div>
  <div class="meta-middle">
    <h3>Filter</h3>
    <label for="compare">Enter the number of cM for your match here:</label>
    <input type="number" id="compare" max="3720" width="8" />
    <a href="#" class="reset">reset</a>
    <br style="clear:both" />
    <br style="clear:both" />
    <label>Then any relationships that fit will stand out below</label>
      <a href="https://dnapainter.com/tools/sharedcm/" id="currentamount">Click here for a sharable link to the cM amount above</a>

  </div>
  <div id="key">
    <h3>How to read this chart</h3>
    <ul>
      <li>
        <div><strong>Relationship</strong><span>Average</span><span>Range<br />(low to high)</span></div>
      </li>
    </ul>
  </div>

  <ul class="rels">
    <li class="clear pad8 span2">
      <div><strong>Great-Great-Grandparent</strong></div>
    </li>
    <li>
      <div><strong>GGGG Aunt/Uncle</strong></div>
    </li>
    <li class="clear pad7 span2">
      <div><strong>Great-Great-Grandparent</strong></div>
    </li>
    <li>
      <div><strong>GGG Aunt/Uncle</strong></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="clear r3" data-start="12" data-end="383">
      <div><strong>Half GG-Aunt/Uncle</strong><span>187</span><span>12 &#8211; 383</span></div>
    </li>
    <li class="span7 r2" data-start="464" data-end="1486">
      <div><strong>Great-Grandparent</strong><span>881</span><span>464 &#8211; 1486</span></div>
    </li>
     <li class="c3" data-start="191" data-end="885">
      <div><strong>Great-Great Aunt/Uncle</strong><span>427</span><span>191 &#8211; 885</span></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="other">
      <div><strong>Other Relationships</strong></div>
    </li>
    <li class="clear dotted">
      <div></div>
    </li>
    <li class="r2" data-start="125" data-end="765">
      <div><strong>Half-Great Aunt / Uncle</strong><span>432</span><span>125 &#8211; 765</span></div>
    </li>
    <li class="span5 r1" data-start="1156" data-end="2311">
      <div><strong>Grandparent</strong><span>1766</span><span>1156 &#8211; 2311</span></div>
    </li>
    <li class="r2" data-start="251" data-end="2108">
      <div><strong>Great Aunt/Uncle</strong><span>914</span><span>251 &#8211; 2108</span></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="other" data-start="0" data-end="86">
      <div><strong>6C</strong><span>21</span><span>0 &#8211; 86</span></div>
    </li>

    <li class="clear dotted">
      <div></div>
    </li>

    <li class="dotted">
      <div></div>
    </li>
    <li class="r1" data-start="500" data-end="1446">
      <div><strong>Half Aunt/Uncle</strong><span>891</span><span>500 &#8211; 1446</span></div>
    </li>
    <li class="span3 r0" data-start="3330" data-end="3720">
      <div><strong>Parent</strong><span>3487</span><span>3330 &#8211; 3720</span></div>
    </li>
    <li class="r1" data-start="1349" data-end="2175">
      <div><strong>Aunt/Uncle</strong><span>1750</span><span>1349 &#8211; 2175</span></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="dotted">
      <div></div>
    </li>
    <li class="other" data-start="0" data-end="72">
      <div><strong>6C1R</strong><span>16</span><span>0 &#8211; 72</span></div>
    </li>
    <li class="clear r3" data-start="0" data-end="178">
      <div><strong>Half 3C</strong><span>61</span><span>0 &#8211; 178</span></div>
    </li>
    <li class="r2" data-start="9" data-end="397">
      <div><strong>Half 2C</strong><span>117</span><span>9 &#8211; 397</span></div>
    </li>
    <li class="r1" data-start="137" data-end="856">
      <div><strong>Half 1C</strong><span>457</span><span>137 &#8211; 856</span></div>
    </li>
    <li class="r0" data-start="1317" data-end="2312">
      <div><strong>Half-Sibling</strong><span>1783</span><span>1317 &#8211; 2312</span></div>
    </li>
    <li class="r0" data-start="2209" data-end="3384">
      <div><strong>Sibling</strong><span>2629</span><span>2209 &#8211; 3384</span></div>
    </li>
    <li class="other">
      <div><strong>SELF</strong></div>
    </li>
    <li class="r1" data-start="553" data-end="1225">
      <div><strong>1C</strong><span>874</span><span>553 &#8211; 1225</span></div>
    </li>
    <li class="r2" data-start="46" data-end="515">
      <div><strong>2C</strong><span>233</span><span>46 &#8211; 515</span></div>
    </li>
    <li class="c3" data-start="0" data-end="217">
      <div><strong>3C</strong><span>74</span><span>0 &#8211; 217</span></div>
    </li>
    <li class="r4" data-start="0" data-end="217">
      <div><strong>4C</strong><span>35</span><span>0 &#8211; 217</span></div>
    </li>
    <li class="r5" data-start="0" data-end="94">
      <div><strong>5C</strong><span>25</span><span>0 &#8211; 94</span></div>
    </li>
    <li class="other" data-start="0" data-end="57">
      <div><strong>6C2R</strong><span>13</span><span>0 &#8211; 57</span></div>
    </li>
    <li class="clear r3" data-start="0" data-end="165">
      <div><strong>Half 3C1R</strong><span>42</span><span>0 &#8211; 165</span></div>
    </li>
    <li class="r2" data-start="0" data-end="341">
      <div><strong>Half 2C1R</strong><span>73</span><span>0 &#8211; 341</span></div>
    </li>
    <li class="r1" data-start="57" data-end="530">
      <div><strong>Half 1C1R</strong><span>226</span><span>57 &#8211; 530</span></div>
    </li>
    <li class="r0" data-start="500" data-end="1446">
      <div><strong>Half-Niece / Nephew</strong><span>891</span><span>500 &#8211; 1446</span></div>
    </li>
    <li class="r0" data-start="1349" data-end="2175">
      <div><strong>Niece / Nephew</strong><span>1750</span><span>1349 &#8211; 2175</span></div>
    </li>
    <li class="rr" data-start="3330" data-end="3720">
      <div><strong>Child</strong><span>3487</span><span>3330 &#8211; 3720</span></div>
    </li>
    <li class="r1" data-start="141" data-end="851">
      <div><strong>1C1R</strong><span>439</span><span>141 &#8211; 851</span></div>
    </li>
    <li class="r2" data-start="0" data-end="316">
      <div><strong>2C1R</strong><span>123</span><span>0 &#8211; 316</span></div>
    </li>
    <li class="r3" data-start="0" data-end="173">
      <div><strong>3C1R</strong><span>48</span><span>0 &#8211; 173</span></div>
    </li>
    <li class="r4" data-start="0" data-end="117">
      <div><strong>4C1R</strong><span>28</span><span>0 &#8211; 117</span></div>
    </li>
    <li class="r5" data-start="0" data-end="79">
      <div><strong>5C1R</strong><span>21</span><span>0 &#8211; 79</span></div>
    </li>
    <li class="other" data-start="0" data-end="57">
      <div><strong>7C</strong><span>13</span><span>0 &#8211; 57</span></div>
    </li>
    <li class="clear r3" data-start="0" data-end="96">
      <div><strong>Half 3C2R</strong><span>34</span><span>0 &#8211; 96</span></div>
    </li>
    <li class="r2" data-start="0" data-end="353">
      <div><strong>Half 2C2R</strong><span>61</span><span>0 &#8211; 353</span></div>
    </li>
    <li class="r1" data-start="37" data-end="360">
      <div><strong>Half 1C2R</strong><span>145</span><span>37 &#8211; 360</span></div>
    </li>
    <li class="r0" data-start="125" data-end="765">
      <div><strong>Half Great-Niece / Nephew</strong><span>432</span><span>125 &#8211; 765</span></div>
    </li>
    <li class="r0" data-start="251" data-end="2108">
      <div><strong>Great Niece / Nephew</strong><span>910</span><span>251 &#8211; 2108</span></div>
    </li>
    <li class="rr" data-start="1156" data-end="2311">
      <div><strong>Grandchild</strong><span>1766</span><span>1156 &#8211; 2311</span></div>
    </li>
    <li class="r1" data-start="43" data-end="531">
      <div><strong>1C2R</strong><span>229</span><span>43 &#8211; 531</span></div>
    </li>
    <li class="r2" data-start="0" data-end="261">
      <div><strong>2C2R</strong><span>74</span><span>0 &#8211; 261</span></div>
    </li>
    <li class="r3" data-start="0" data-end="116">
      <div><strong>3C2R</strong><span>35</span><span>0 &#8211; 116</span></div>
    </li>
    <li class="r4" data-start="0" data-end="109">
      <div><strong>4C2R</strong><span>22</span><span>0 &#8211; 109</span></div>
    </li>
    <li class="r5" data-start="0" data-end="43">
      <div><strong>5C2R</strong><span>17</span><span>0 &#8211; 43</span></div>
    </li>
    <li class="other" data-start="0" data-end="53">
      <div><strong>7C1R</strong><span>13</span><span>0 &#8211; 53</span></div>
    </li>

    <li class="clear r3">
      <div><strong>Half 3C3R</strong></div>
    </li>
    <li class="r2">
      <div><strong>Half 2C3R</strong></div>
    </li>
    <li class="r1" data-start="0" data-end="191">
      <div><strong>Half 1C3R</strong><span>87</span><span>0 &#8211; 191</span></div>
    </li>
    <li class="r0" data-start="12" data-end="383">
      <div><strong>Half GG Niece / Nephew</strong><span>187</span><span>12 &#8211; 383</span></div>
    </li>
    <li class="r0" data-start="191" data-end="885">
      <div><strong>Great Great Niece / Nephew</strong><span>427</span><span>191 &#8211; 885</span></div>
    </li>
    <li class="rr" data-start="464" data-end="1486">
      <div><strong>Great-Grandchild</strong><span>881</span><span>464 &#8211; 1486</span></div>
    </li>
    <li class="r1" data-start="0" data-end="283">
      <div><strong>1C3R</strong><span>123</span><span>0 &#8211; 283</span></div>
    </li>
    <li class="r2" data-start="0" data-end="139">
      <div><strong>2C3R</strong><span>57</span><span>0 &#8211; 139</span></div>
    </li>
    <li class="r3" data-start="0" data-end="69">
      <div><strong>3C3R</strong><span>22</span><span>0 &#8211; 69</span></div>
    </li>
    <li class="r4" data-start="0" data-end="82">
      <div><strong>4C3R</strong><span>29</span><span>0 &#8211; 82</span></div>
    </li>
    <li class="r5" data-start="0" data-end="44">
      <div><strong>5C3R</strong><span>11</span><span>0 &#8211; 44</span></div>
    </li>
    <li class="other" data-start="0" data-end="50">
      <div><strong>8C</strong><span>12</span><span>0 &#8211; 50</span></div>
    </li>
  </ul>
  <br style="clear:both" />
</body>

</html>
              
            
!

CSS

              
                body {
  background: #fff;
  font-size: 0.85vmax;
  font-family: helvetica neue, sans-serif;
  padding: 10px 10px 50px;
  min-width: 747px;
}
ul.rels:after {
  content: "";
  display: block;
  margin-bottom: 20px;
}
#compare {
  width: 100px;
  box-sizing: border-box;
  font-size: 18px;
  border: 1px dashed #ccc;
  padding: 10px;
}

ul.rels {
  clear: both;
  padding: 20px 0 0 0;
  max-width: 1200px;
  margin: 0 auto;
}
p {
  margin: 0;
  padding: 0 0 0.25rem;
}
ul {
  list-style: none;
}
a {
  text-decoration: none;
  color: darkgreen;
}
.meta-left {
  float: left;
}
.meta-middle {
  float: left;
  padding-left: 40px;
}
#key {
  float: left;
  padding-left: 40px;
}
#key li {
  width: 8.333vw;
}
h3 {
  margin-bottom: 10px;
}
label {
  clear: both;
  display: block;
  margin-bottom: 10px;
}
.reset {
  padding: 10px;
  border: 1px solid #ccc;
  background: #ccc;
  color: #000;
  display: block;
  clear: both;
  margin-left: 20px;
  float: right;
}
ul li {
  float: left;
  text-align: center;
  width: 8.33333332%;
  box-sizing: border-box;
  display: table;
  background: #ccc;
  height: 86px;
}
ul li div {
  display: table-cell;
  vertical-align: middle;
  border: 1px solid #efefef;
  box-sizing: border-box;
}
ul li.r3,
ul li.c3 {
  background: #aaa;
}
ul li.r1 {
  background: #adda7b;
}
ul li.r0 {
  background: #d1d8e2;
}
ul li.other {
  background: #fff;
  font-size: 0.75vmax;
}
ul li.r2 {
  background: #f5c3a0;
}
ul li.rr {
  background: #b4c7e7;
}
ul li.r4 {
  background: #ffeeb8;
}
ul li.r5 {
  background: #d0cdff;
}
ul li.dotted {
  background: none;
}
ul li.dotted div {
  display: block;
  width: 50%;
  height: 86px;
  border: 0;
  border-left: 1px solid #fff;
  border-right: 1px dashed #aaa;
}
ul li strong,
ul li span {
  display: block;
}
ul li.span5 {
  width: 41.666666666666%;
}
ul li.span7 {
  width: 58.333333333333%;
}
ul li.span3 {
  width: 25%;
}
ul li.span2 {
  width: 16.666666666666%;
}
ul li.pad7 {
  margin-left: 58.333333333333%;
}
ul li.pad8 {
  margin-left: 66.666666666666%;
}
ul li.pad9 {
  margin-left: 74.999999999999%;
}
li.clear {
  clear: left;
}
strong {
  word-wrap: break-word;
}
.is-animated {
  -webkit-animation: 0.6s zoom-in;
  animation: 0.6s zoom-in;
}

@-webkit-keyframes zoom-in {
  0% {
    -webkit-transform: scale(0.1);
    transform: scale(0.1);
  }
  100% {
    -webkit-transform: none;
    transform: none;
  }
}

@keyframes zoom-in {
  0% {
    -webkit-transform: scale(0.1);
    transform: scale(0.1);
  }
  100% {
    -webkit-transform: none;
    transform: none;
  }
}

              
            
!

JS

              
                (function($) {
  // todo:
  // add a slider
  // possibly highlight the three matches that are closest to the entered value.

  "use strict";
  var delay = (function() {
    var timer = 0;
    return function(callback, ms) {
      clearTimeout(timer);
      timer = setTimeout(callback, ms);
    };
  })();
  var presetcm = '{{ params.toolVar }}';

  $(".reset").on("click", function(e) {
    e.preventDefault();
    $("#compare").val("");
    resetChart();
  });
  $("#compare").on("keyup", function(e) {
    delay(function() {
    var currentval = parseInt($("#compare").val());
     filterChart(currentval);
     if($.isNumeric(currentval)){
        $("#currentamount").attr('href','{{site.uri.public}}/tools/sharedcm/'+currentval);
      }
      else {
        $("#currentamount").attr('href','{{site.uri.public}}/tools/sharedcm/');
      }
    }, 500);
  });
  if($.isNumeric(presetcm)){
    $("#compare").val(presetcm);
    delay(function() {
       filterChart(parseInt(presetcm));
    },500);
  }
})(jQuery);

function filterChart($enteredval) {
 //var $enteredval = );
      var $rels = $(".rels li");
      if ($("#compare").val() == "" ) {
        resetChart();
      }
      $(".rels").addClass("filtered");
      $rels
        .removeClass("is-animated")
        .fadeTo("fast", 0.25)
        .promise()
        .done(function() {
          $rels
            .filter(function(i) {
              return (
                $(this).attr("data-start") !== undefined &&
                $enteredval >= $(this).attr("data-start") &&
                $enteredval <= $(this).attr("data-end")
              );
            })
            .addClass("is-animated")
            .fadeTo("fast", 1);
        });
}

function resetChart() {
  $(".rels").removeClass("filtered");
  $(".rels li").removeClass("is-animated").fadeOut().promise().done(function() {
  $(".rels li").addClass("is-animated").fadeTo("fast", 1);
  $("#currentamount").attr('href','https://dnapainter.com/tools/sharedcm/');

  });
}
              
            
!
999px

Console