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. 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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="container my-container">
    <div class="row my-row">
        <div class="col my-col">
            <h1>Twitch Streamers</h1>
        </div>
    </div>

    <div class="row my-row">
        <div class="col my-col">
            <button class="all btn btn-info" type="button" id="all">All</button>
        </div>
        <div class="col my-col">
            <button class="online btn btn-success" type="button" id="online">Online</button>
        </div>
        <div class="col my-col">
            <button class="offline btn btn-danger" type="button" id="offline">Offline</button>
        </div>
    </div>
      
          
    <div class="container">
        <div class="row">
            <div class="col">
                <table class="table table-striped table-bordered table-sm">
                    <tbody id="channels">
                            
                    <tr class="border_bottom">
                        <td id="channel0"></td>
                        <td class="align-middle" id="displayname0"></td>
                        <td class="align-middle" id="info0"></td>
                    </tr>
                    <tr class="border_bottom">
                        <td id="channel1"></td>
                        <td class="align-middle" id="displayname1"></td>
                        <td class="align-middle" id="info1"></td>
                     </tr>
                    <tr class="border_bottom">
                        <td id="channel2"></td>
                        <td class="align-middle" id="displayname2"></td>
                        <td class="align-middle" id="info2"></td>
                    </tr>
                    <tr class="border_bottom">
                        <td id="channel3"></td>
                        <td class="align-middle" id="displayname3"></td>
                        <td class="align-middle" id="info3"></td>
                    </tr>
                    <tr class="border_bottom">
                        <td id="channel4"></td>
                        <td class="align-middle" id="displayname4"></td>
                        <td class="align-middle" id="info4"></td>
                    </tr>
                    <tr class="border_bottom">
                        <td id="channel5"></td>
                        <td class="align-middle" id="displayname5"></td>
                        <td class="align-middle" id="info5"></td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>  
<footer class="footer">
  <div class="container">
    <span class="text-muted">
      <p class="text-center">&copy; 2018 Phoebe Voong-Fadel | The Coding Hamster. All rights reserved.</p>
    </span>
  </div>
</footer>
        

              
            
!

CSS

              
                img {
  border-radius: 50%;
  height: 50px;
  border-style: solid;
  border-color: white;

}

body {
  text-align: center;
  font-family: 'Open Sans', sans-serif;
  line-height: 1.6;
}

h1 {
  font-size: 4rem;
  display: inline-block;
  border-bottom: solid 5px #408EE0;
  vertical-align: middle;
  letter-spacing: 0.02em;
  line-height: 1.1;
  padding-bottom: 10px;
}

.row {
  padding-top: 1.5rem
}

.col {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

a {
  color: black;
  text-decoration: none;
}

.container {
  max-width: 800px; 
}

.footer {
  bottom: 0;
  width: 100%;
  height: 50px;
}

.footer p {
  font-size: 0.8rem;
  color: grey;
}
              
            
!

JS

              
                $(document).ready(function() { 
  var channels = ["ESL_SC2", "freecodecamp", "imdb", "syndicate", "dreamleague", "towelliee"];
  var url = "https://wind-bow.glitch.me/twitch-api/streams/";
  var urlLogo = "https://wind-bow.glitch.me/twitch-api/channels/";  

    //Loop for channel info
  for (var i = 0; i < channels.length; i++) {
    (function(i) { 
      $.getJSON(urlLogo + channels[i], function(data) {   
        var logo = data.logo;
        var channelLink = data.url;
        var displayName = data.display_name;
          $("#channel" + i).html("<img src=" + logo + ">");
          $("#displayname" + i).html("<a href=" + channelLink + " target=\"_blank\">" + displayName + "</a>");
      });
    })(i);
  }
  
  //Loop for stream info if channel online
  for (var j = 0; j < channels.length; j++) {
    (function(j) { 
      $.getJSON(url + channels[j], function(data) { 

        var streamGame = data.stream.channel.game;
        var streamGameInfo = data.stream.channel.status; 
          $("#info" + j).html(streamGame + ": " + streamGameInfo);
        });
    })(j);
  }

//Loop for offline channels
  for (var k = 0; k < channels.length; k++) {
    (function(k) { 
      $.getJSON(url + channels[k], function(data) { 
        if (data.stream == null) { 
          $("#info" + k).html("Offline");
          }
        });
      })(k);
    }

 }) 


 //Show offline channels
$("#offline").click(function () {
    var rows = $("#channels").find("tr").hide();
    rows.filter(":contains('Offline')").show();
 });

//Show online channels
$("#online").click(function () {
    var rows = $("#channels").find("tr").show();
    rows.filter(":contains('Offline')").hide();
 }); 

//Show all channels
$("#all").click(function() {
  $("#channels").find("tr").show();
});



              
            
!
999px

Console