123

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1>2015-16 San Jose Sharks</h1>
<ul id="cards" class="cards">

</div>
            
          
!
            
              // Color Variables
$pacific-teal: #088696;
$black: #000;
$white: #FFF;
$orange: #f28f20;

// breakpoints
$desktop: 960px;

// Material Shadows Mixin
@mixin material-shadow($level){
    @if $level == 1 {
        box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    } @elseif $level == 2 {
        box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    } @elseif $level == 3 {
        box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    } @elseif $level == 4 {
        box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
    } @elseif $level == 5 {
        box-shadow: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
    }
}
*{
  box-sizing: border-box;
}
body {
  background-color: #ddd;
  font-family: 'Roboto', sans-serif;
}
img {
  max-width: 100%;
  display: block;
  margin: 0;
}
ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1 {
  font-size: 2em;
  color: $pacific-teal;
  font-weight: 700;
  display: block;
  text-align: center;
}

h2 {
  font-size: 1.3em;
  margin: 0.2em 0;
  text-align: center;
  font-weight: 400;
}
.cards {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: center;
}

.top-bar {
  background-color: darken($pacific-teal, 10%);
  height: 1em;
  border-radius: 5px 5px 0 0;
}

header {
  background-color: $pacific-teal;
  padding: 0.5em;
  color: white;
  font-weight: bold;
  @include material-shadow(1);
}

.card {
  @include material-shadow(1);
  position: relative;
  margin: 1em;
  transition: all 250ms;
  max-width: 300px;
  @media only screen and (min-width : $desktop){
    max-width: 400px;
  }
  
  img {
    @include material-shadow(1);
  }
  
  span {
    @include material-shadow(2);
    position: absolute;
    background-color: $orange;
    color: white;
    height: 3em;
    width: 3em;
    text-align: center;
    line-height: 3em;
    font-weight: 700;
    border-radius: 50%;
    right:1em;
    bottom:6.5em;
  }
}
.dragging {
  @include material-shadow(5);
  transform: scale(1.02);
}
.stats {
  background-color: white;
  padding: 1.5em;
  border-radius: 0 0 5px 5px;
}
table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 0 0 5px 5px;
  
  caption {
    font-size: 1.2em;
    margin: 0 0 0.5em 0;
  }
  
  th {
    color: #757575;
    font-weight: 300;
    text-align: center;
  }
  
  td {
    text-align: center;
  }
  
  tr {
    line-height: 1.5em;
  }
  
  tr:first-child {
    border-bottom: 1px solid #424242;
  }
}
            
          
!
            
              var sjsharks = {
  "players": {
    12: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/12.jpg",
      "name": "Patrick Marleau",
      "position": "C",
      "stats": {
        "GP": 82,
        "G": 25,
        "A": 23,
        "P": 48,
        "plusMinus": -22,
        "PIM": 10,
        "PP": 11,
        "SH": 1,
        "GW": 5,
        "S": 216,
        "shotPercent": 11.6
      }
    },
    19: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/19.jpg",
      "name": "Joe Thornton",
      "position": "C",
      "stats": {
        "GP": 82,
        "G": 19,
        "A": 63,
        "P": 82,
        "plusMinus": 25,
        "PIM": 54,
        "PP": 8,
        "SH": 0,
        "GW": 6,
        "S": 121,
        "shotPercent": 15.7
      }
    },
    8: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/8.jpg",
      "name": "Joe Pavelski",
      "position": "C",
      "stats": {
        "GP": 82,
        "G": 38,
        "A": 40,
        "P": 78,
        "plusMinus": 25,
        "PIM": 30,
        "PP": 12,
        "SH": 0,
        "GW": 11,
        "S": 224,
        "shotPercent": 17.00
      }
    },
    88: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/88.jpg",
      "name": "Brent Burns",
      "position": "D",
      "stats": {
        "GP": 82,
        "G": 27,
        "A": 48,
        "P": 75,
        "plusMinus": -5,
        "PIM": 53,
        "PP": 7,
        "SH": 1,
        "GW": 4,
        "S": 353,
        "shotPercent": 7.6
      }
    },
    48: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/48.jpg",
      "name": "Tomas Hertl",
      "position": "C",
      "stats": {
        "GP": 81,
        "G": 21,
        "A": 25,
        "P": 46,
        "plusMinus": 16,
        "PIM": 26,
        "PP": 3,
        "SH": 0,
        "GW": 3,
        "S": 202,
        "shotPercent": 10.40
      }
    },
    42: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/42.jpg",
      "name": "Joel Ward",
      "position": "R",
      "stats": {
        "GP": 79,
        "G": 21,
        "A": 22,
        "P": 43,
        "plusMinus": -15,
        "PIM": 28,
        "PP": 5,
        "SH": 1,
        "GW": 3,
        "S": 138,
        "shotPercent": 15.20
      }
    },
    44: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/44.jpg",
      "name": "Marc-Edouard Vlasic",
      "position": "D",
      "stats": {
        "GP": 67,
        "G": 8,
        "A": 31,
        "P": 39,
        "plusMinus": 15,
        "PIM": 48,
        "PP": 2,
        "SH": 0,
        "GW": 0,
        "S": 116,
        "shotPercent": 6.90
      }
    },
    39: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/39.jpg",
      "name": "Logan Couture",
      "position": "C",
      "stats": {
        "GP": 52,
        "G": 15,
        "A": 21,
        "P": 36,
        "plusMinus": 2,
        "PIM": 20,
        "PP": 5,
        "SH": 0,
        "GW": 4,
        "S": 137,
        "shotPercent": 10.9
      }
    },
    27: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/27.jpg",
      "name": "Joonas Donskoi",
      "position": "R",
      "stats": {
        "GP": 76,
        "G": 11,
        "A": 25,
        "P": 36,
        "plusMinus": 4,
        "PIM": 20,
        "PP": 3,
        "SH": 0,
        "GW": 1,
        "S": 107,
        "shotPercent": 10.30
      }
    },
    61: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/61.jpg",
      "name": "Justin Braun",
      "position": "D",
      "stats": {
        "GP": 80,
        "G": 4,
        "A": 19,
        "P": 23,
        "plusMinus": 11,
        "PIM": 36,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 114,
        "shotPercent": 3.50
      }
    },
    7: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/7.jpg",
      "name": "Paul Martin",
      "position": "D",
      "stats": {
        "GP": 78,
        "G": 3,
        "A": 17,
        "P": 20,
        "plusMinus": 13,
        "PIM": 22,
        "PP": 1,
        "SH": 0,
        "GW": 0,
        "S": 49,
        "shotPercent": 6.10
      }
    },
    50: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/50.jpg",
      "name": "Chris Tierney",
      "position": "C",
      "stats": {
        "GP": 79,
        "G": 7,
        "A": 13,
        "P": 20,
        "plusMinus": -16,
        "PIM": 20,
        "PP": 1,
        "SH": 1,
        "GW": 2,
        "S": 96,
        "shotPercent": 7.30
      }
    },
    68: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/68.jpg",
      "name": "Melker Karlsson",
      "position": "C",
      "stats": {
        "GP": 65,
        "G": 10,
        "A": 9,
        "P": 19,
        "plusMinus": 5,
        "PIM": 16,
        "PP": 0,
        "SH": 0,
        "GW": 1,
        "S": 96,
        "shotPercent": 10.40
      }
    },
    57: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/57.jpg",
      "name": "Tommy Wingels",
      "position": "C",
      "stats": {
        "GP": 68,
        "G": 7,
        "A": 11,
        "P": 18,
        "plusMinus": -10,
        "PIM": 63,
        "PP": 1,
        "SH": 0,
        "GW": 0,
        "S": 111,
        "shotPercent": 6.30
      }
    },
    83: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/83.jpg",
      "name": "Matt Nieto",
      "position": "L",
      "stats": {
        "GP": 67,
        "G": 8,
        "A": 9,
        "P": 17,
        "plusMinus": -8,
        "PIM": 10,
        "PP": 0,
        "SH": 2,
        "GW": 1,
        "S": 90,
        "shotPercent": 8.90
      }
    },
    4: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/4.jpg",
      "name": "Brenden Dillon",
      "position": "D",
      "stats": {
        "GP": 76,
        "G": 2,
        "A": 9,
        "P": 11,
        "plusMinus": 8,
        "PIM": 61,
        "PP": 0,
        "SH": 0,
        "GW": 1,
        "S": 93,
        "shotPercent": 2.20
      }
    },
    9: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/9.jpg",
      "name": "Dainius Zubrus",
      "position": "C",
      "stats": {
        "GP": 50,
        "G": 3,
        "A": 4,
        "P": 7,
        "plusMinus": 4,
        "PIM": 20,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 33,
        "shotPercent": 9.10
      }
    },
    16: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/16.jpg",
      "name": "Nick Spaling",
      "position": "C",
      "stats": {
        "GP": 23,
        "G": 2,
        "A": 4,
        "P": 6,
        "plusMinus": 5,
        "PIM": 6,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 21,
        "shotPercent": 9.50
      }
    },
    74: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/74.jpg",
      "name": "Dylan Demelo",
      "position": "D",
      "stats": {
        "GP": 45,
        "G": 2,
        "A": 2,
        "P": 4,
        "plusMinus": 0,
        "PIM": 14,
        "PP": 2,
        "SH": 0,
        "GW": 0,
        "S": 42,
        "shotPercent": 4.80
      }
    },
    80: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/80.jpg",
      "name": "Matt Tennyson",
      "position": "D",
      "stats": {
        "GP": 29,
        "G": 1,
        "A": 3,
        "P": 4,
        "plusMinus": 1,
        "PIM": 0,
        "PP": 1,
        "SH": 0,
        "GW": 0,
        "S": 23,
        "shotPercent": 4.30
      }
    },
    46: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/46.jpg",
      "name": "Roman Polak",
      "position": "D",
      "stats": {
        "GP": 24,
        "G": 0,
        "A": 3,
        "P": 3,
        "plusMinus": -2,
        "PIM": 16,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 35,
        "shotPercent": 0.00
      }
    },
    89: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/89.jpg",
      "name": "Barclay Goodrow",
      "position": "R",
      "stats": {
        "GP": 14,
        "G": 0,
        "A": 3,
        "P": 3,
        "plusMinus": 1,
        "PIM": 16,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 7,
        "shotPercent": 0.00
      }
    },
    82: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/82.jpg",
      "name": "Nikolay Goldobin",
      "position": "L",
      "stats": {
        "GP": 9,
        "G": 1,
        "A": 1,
        "P": 2,
        "plusMinus": 1,
        "PIM": 0,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 7,
        "shotPercent": 14.30
      }
    },
    38: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/38.jpg",
      "name": "Micheal Haley",
      "position": "C",
      "stats": {
        "GP": 16,
        "G": 1,
        "A": 0,
        "P": 1,
        "plusMinus": -2,
        "PIM": 48,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 10,
        "shotPercent": 10.00
      }
    },
    17: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/17.jpg",
      "name": "John McCarthy",
      "position": "C",
      "stats": {
        "GP": 1,
        "G": 0,
        "A": 0,
        "P": 0,
        "plusMinus": 0,
        "PIM": 0,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 0,
        "shotPercent": 0.00 
      }
    },
    11: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/11.jpg",
      "name": "Bryan Lerg",
      "position": "C",
      "stats": {
        "GP": 6,
        "G": 0,
        "A": 0,
        "P": 0,
        "plusMinus": 1,
        "PIM": 0,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 4,
        "shotPercent": 0.00
      }
    },
    41: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/41.jpg",
      "name": "Mirco Mueller",
      "position": "D",
      "stats": {
        "GP": 11,
        "G": 0,
        "A": 0,
        "P": 0,
        "plusMinus": -4,
        "PIM": 7,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 8,
        "shotPercent": 0.00 
      }
    },
    40: {
      "image": "https://s3-us-west-2.amazonaws.com/s.cdpn.io/25240/40.jpg",
      "name": "Ryan Carpenter",
      "position": "C",
      "stats": {
        "GP": 1,
        "G": 0,
        "A": 0,
        "P": 0,
        "plusMinus": 0,
        "PIM": 0,
        "PP": 0,
        "SH": 0,
        "GW": 0,
        "S": 0,
        "shotPercent": 0
      }
    }
  }
}
var cards = document.getElementById('cards');
for(var key in sjsharks.players){
  cards.innerHTML += 
  '<li class="card"> \
    <div class="top-bar"></div> \
      <header><h2>' + sjsharks.players[key].name + ' | ' + sjsharks.players[key].position + '</h2></header> \
      <img src="' + sjsharks.players[key].image + '" alt="' + sjsharks.players[key].name + '" />\
      <span class="circle">' + key + '</span> \
      <div class="stats"> \
        <table> \
          <caption>2015-2016 Stats</caption> \
          <tr> \
            <th>GP</th> \
            <th>G</th> \
            <th>A</th> \
            <th>P</th> \
            <th>+/-</th> \
            <th>PIM</th> \
            <th>PP</th> \
            <th>SH</th> \
            <th>GW</th> \
            <th>S</th> \
            <th>S%</th> \
          </tr> \
          <tr> \
            <td>' + sjsharks.players[key].stats.GP + '</td> \
            <td>' + sjsharks.players[key].stats.G + '</td> \
            <td>' + sjsharks.players[key].stats.A + '</td> \
            <td>' + sjsharks.players[key].stats.P + '</td> \
            <td>' + sjsharks.players[key].stats.plusMinus + '</td> \
            <td>' + sjsharks.players[key].stats.PIM + '</td> \
            <td>' + sjsharks.players[key].stats.PP + '</td> \
            <td>' + sjsharks.players[key].stats.SH + '</td> \
            <td>' + sjsharks.players[key].stats.GW + '</td> \
            <td>' + sjsharks.players[key].stats.S + '</td> \
            <td>' + sjsharks.players[key].stats.shotPercent + '</td> \
          </tr> \
        </table> \
      </div> \
  </li>';
}
function addShadow() {
  e.target.classList = 'dragging';
}
var items = cards.querySelectorAll('.card');
console.log(items);
$(function() {
    $( "#cards" ).sortable({
      revert: true
    });
    $( "ul, li" ).disableSelection();
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console