Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.

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

              
                <div class="wrapper">
  <header>
    <h1 class="heading">Twitch.tv App</h1>
  </header>
  <main>

    <!-- All streamers -->
    <div class="all-streamers">
      <p class="streamers-heading">All Streamers</p>
      <span>+</span>
    </div>
    <div class="animated slideInUp" id="all">

    </div>

    <!-- online streamers -->
    <div class="online-streamers">
      <p class="streamers-heading">Online Streamers</p>
      <span>+</span>
    </div>
    <div class="animated slideInUp" id="online">
    </div>

    <!-- offline streamers -->
    <div class="offline-streamers">
      <p class="streamers-heading">Offline Streamers</p>
      <span>+</span>
    </div>
    <div class="animated slideInUp" id="offline">
    </div>
  </main>
  <footer>
    <p>Hand-coded by <a class="footer-link" href="https://github.com/Azdrian" target="_blank">U'el Azdrian Small</a> &copy; 2016.</p>
  </footer>
</div>
              
            
!

CSS

              
                /********************************
Mobile layout First styles
*********************************/


/***************************
Body
****************************/

body {
  background-color: purple;
}


/***************************
wrapper
****************************/

.wrapper {
  height: 100%;
  margin: 0 auto;
  max-width: 800px;
  width: 100%;
}

.heading {
  color: white;
  font-family: 'Russo One', sans-serif;
  font-size: 2em;
  margin-top: 0;
  text-align: center;
}

/***************************
Streamers Tabs
****************************/

.streamers-heading {
  color: white;
  font-family: 'Playfair Display', serif;
  font-size: 1em;
  margin-top: 10px;
}

.all-streamers,
.online-streamers,
.offline-streamers {
  cursor: pointer;
  height: 60px;
  text-align: center;
  position: relative;
}

span {
  bottom: 35%;
  color: white;
  position: absolute;
  right: 5%;
}

.all-streamers {
  background-color: #101668;
  padding-top: 15px;
}

.online-streamers {
  background-color: #106820;
  padding-top: 15px;
}

.offline-streamers {
  background-color: #681010;
  padding-top: 15px;
}

/**************************************
streamers content
**************************************/

#all,
#online,
#offline {
  margin-top: 20px;
}

.streamer img {
  height: 150px;
  width: 150px;
}

.streamer {
  border: 1px solid white;
  margin-bottom: 20px;
  padding: 20px;
  text-align: center;
 
 
}

.streamer-name {
  color: white;
  text-decoration: none;
}

.streamer p {
  margin: 5px;
}

.bold-text{
  font-weight:400; 
}
.online {
  color: #106820;
  font-weight: bold;
}

.offline {
  color: #681010;
  font-weight: bold;
}
/*************************
Footer
**************************/

footer p {
  font-size: 0.7em;
  text-align: center;
}

footer p,
.footer-link {
  color: white;
}
/**************************************
Media Queries
**************************************/
@media (min-width:600px) {
  heading {
    font-size: 3em;
  }
  #all,
  #online,
  #offline {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-left: 22px;
  }
  .streamer {
    display: inline-block;
    width: 30%;
    margin-right: 20px;
  }
  footer p {
    font-size: 1em;
  }
}

@media (min-width:728px) {
  .heading {
    font-size: 4em;
  }
  
   #all,
  #online,
  #offline {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-left: 22px;
  }
  .streamer {
    display: inline-block;
    margin-right: 20px;
    width: 30%;
  }
  footer p {
    font-size: 1em;
  }
}
/***********************************
media queries for tablets & desktops
***********************************/
@media (min-width:800px) {
  .heading {
    font-size: 4em;
  }
  
   #all,
  #online,
  #offline {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-left: 22px;
  }
  .streamer {
    display: inline-block;
    margin-right: 20px;
    width: 30%;
  }
  footer p {
    font-size: 1em;
  }
}

@media (min-width:1024px) {
  .heading {
    font-size: 4em;
  }
   #all,
  #online,
  #offline {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-left: 22px;
  }
  .streamer {
    display: inline-block;
    margin-right: 20px;
    width: 30%;
  }
  footer p {
    font-size: 1em;
  }
}
              
            
!

JS

              
                $(function() {
  var streamers = ["dreamhackcs", "skyzhar", "freecodecamp", "faceittv", "comster404", "brunofin",
    "terakilobyte", "robotcaleb", "sheevergaming", "esl_sc2", "ogamingsc2", "jacksofamerica", "cretetion"
  ];

  var getTwitchApiData = function(streamer) {
    var $streamApiUrl = "https://api.twitch.tv/kraken/streams/" + streamers[i] + "?client_id=k1i2e1f36x8noimivhcdazeguby6nv2&callback=?",
      $channelApiUrl = "https://api.twitch.tv/kraken/channels/" + streamers[i] + "?client_id=k1i2e1f36x8noimivhcdazeguby6nv2&callback=?";

    $.ajax({
      type: "GET",
      dataType: "jsonp",
      url: $streamApiUrl,
      headers: {
        'Client-ID': 'k1i2e1f36x8noimivhcdazeguby6nv2'
      },
      success: function($streamData) {
          var onlineStatus = '';
          if ($streamData.status === 404 || $streamData.status === 422) {
            onlineStatus = $streamData.message;
            var defaultLogoUrl = "https://static-cdn.jtvnw.net/jtv-static/404_preview-300x300.png";
            $('#all').append(
              "<div class='streamer'>" +
              "<img src=" + defaultLogoUrl + ">" +
              "<p class='streamer-name'>" + streamer + "</p>" +
              "<p class='account-closed'>" + onlineStatus + "</p>" +
              "</div>"
            );

          } else if ($streamData.stream !== null) {
            onlineStatus = 'online';
            $('#all,#online').append(
              "<div class='streamer '>" +
              "<img src=" + $streamData.stream.channel.logo + ">" +
              "<p ><a class='streamer-name' href=" + $streamData.stream.channel.url + " target='_blank'>" +
              $streamData.stream.channel.display_name + "</a></p>" +
              "<p class='online'>" + onlineStatus + "</p>" +
              "<p>Streaming: " + $streamData.stream.game + " - " + $streamData.stream.channel.status + "</p>" +
              "</div>"
            );

          } else {
            $.ajax({
              type: "GET",
              dataType: "jsonp",
              url: $channelApiUrl,
              headers: {
                'Client-ID': 'k1i2e1f36x8noimivhcdazeguby6nv2'
              },
              success: function($channelData) {
                if ($channelData.logo === null) {
                  $channelData.logo = "https://static-cdn.jtvnw.net/jtv-static/404_preview-300x300.png";
                } else {
                  $channelData.logo;
                }

                onlineStatus = 'offline';
                $('#all,#offline').append(
                  "<div class='streamer'>" +
                  "<img src=" + $channelData.logo + ">" +
                  "<p><a class='streamer-name' href=" + $channelData.url + " target='_blank'>" + $channelData.display_name + "</a></p>" +
                  "<p class='offline'>" + onlineStatus + "</p>" +
                  "</div>"
                );
              }
            });
          }

        } //end of main ajax success
    }); //main ajax request

  };

  /*Loop through  the streamers array, as  each streamer is pass to the function
  to get the corresponding data */
  for (var i = 0, len = streamers.length; i < len; i++) {
    getTwitchApiData(streamers[i]);
  } //end of for loop

  //Hide streamers content
  $('#all, #online, #offline').hide();

  /* When either the all, offline and online streamers tab is clicked it
  will show the corresponding Data */
  $('.all-streamers').on('click', function() {
    $('#all').slideToggle('slow');

    //When either  all, offline and online streamers tab is clicked change "+" to "-"
    if ($('.all-streamers span').text() === '+') {
      $(this).children('span').html('-');
    } else {
      $(this).children('span').html('+');
    }
  });

  $('.online-streamers').on('click', function() {
    $('#online').slideToggle('slow');

    if ($('.online-streamers span').text() === '+') {
      $(this).children('span').html('-');
    } else {
      $(this).children('span').html('+');
    }
  });

  $('.offline-streamers').on('click', function() {
    $('#offline').slideToggle('slow');

    if ($('.offline-streamers span').text() === '+') {
      $(this).children('span').html('-');
    } else {
      $(this).children('span').html('+');
    }

  });
});
              
            
!
999px

Console