cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <div id="container">
    <img id="twitch-logo" src="http://s.jtvnw.net/jtv_user_pictures/hosted_images/Twitch_Logo_White.png">
    <ul id="streams" class="clearfix"></ul>
    <a id="portfolio" href="http://www.danielstrong.io" target="_blank">by daniel strong</a>
</div>
            
          
!
            
              * {
    box-sizing: border-box;
}

.clearfix {
    content: "";
    display: table;
    clear: both;
}

body {
    font-family: 'Raleway', sans-serif;
    background: url('https://cdn3.iconfinder.com/data/icons/line/36/ghost-512.png') center;
    background-size: 125px;
    background-color: #262626;
}

#twitch-logo {
    width: 85%;
    max-width: 300px;
    padding: 0;
    margin: 0 auto 50px auto;
}

#container {
    width: 95%;
    max-width: 650px;
    min-width: 450px;
    text-align: center;
    background-color: #6441A5;
    border: 10px solid #6441A5;
    border-radius: 8px;
    padding: 75px 0;
    margin: 75px auto;
}

#streams {
    width: 100%;
    padding: 0;
    margin: 0;
}

#streams li {
    width: 100%;
    height: 80px;
    background-color: #3b2064;
    list-style-type: none;
    padding: 5px 10px 5px 20px;
    margin: 0 0 10px 0;
    transition: .15s;
}

#streams li:hover {
    cursor: default;
}

.online:hover {
    background-color: #4D2B80 !important;
    box-shadow: -10px 0 0 #fff;
}

#streams li p {
    margin: 0;
}

.offline {
    background: url('https://i.imgur.com/ucizOMQ.png') center;
    background-size: 175px;
    background-color: #262626 !important;
}

.left {
    position: relative;
    float: left;
    height: 100%;
}

.title {
    color: #fff;
    font-size: 1.25em;
    text-decoration: none;
}

.title:hover {
    cursor: pointer;
}

.title-offline {
    line-height: 65px;
    color: #aaa;
    font-size: 1.25em;
}

.game {
    font-size: initial;
    color: #B9A3E3;
}

.viewers {
    position: absolute;
    left: 0;
    color: #aaa;
}

.logo {
    height: 70px;
    float: right;
    padding: 5px 0;
    margin: 0;
}

#portfolio {
    float: right;
    text-decoration: none;
    color: #B9A3E3;
    padding: 25px;
}

#portfolio:hover {
    color: #fff;
}





            
          
!
            
              var streamers = ['freecodecamp', 'dansgaming', 'ZiggyDLive', 'LIRIK', 'nl_Kripp', 'Helmann', 'brunofin', 'WrelPlays'];
var streamer = [];
var ul = document.getElementById('streams');
var html = '';

// GET DATA FOR EACH STREAMER ONE AT A TIME
streamers.forEach(function(person) {
    $.get('https://api.twitch.tv/kraken/streams/' + person, function(data) {
        streamer = data;
        name = person;
        // PASS THAT DATA TO THE LIST FUNCTION
        listStreams(streamer, name);
    });
});

// DISPLAY EACH STREAMER
function listStreams() {
    // ACCOUNT DOES NOT EXIST
    if (streamer.status === 422) {
        html += '<li class="offline clearfix"><p class="title-offline">' + streamer.message + '</p></li>';
    }
    // OFFLINE
    else if (streamer.stream == null) {
        html += '<li class="offline clearfix"><div class="left"><p class="title-offline">' + name + ' is Offline</p></div></li>';
    }
    // ONLINE
    else {
        html += '<li class="online clearfix"><div class="left"><span class="title">' + streamer.stream.channel.display_name + '</span><span class="game">&nbsp; - &nbsp;' + streamer.stream.channel.game + '</span></p><br /><span class="viewers">' + streamer.stream.viewers.toLocaleString() + ' viewers</span></div><a href="' + streamer.stream.channel.url + '" target="_blank"><img class="logo" src="' + streamer.stream.channel.logo + '"></a></li>';
    }
    // APPEND HTML TO LIST
    ul.innerHTML = html;
}
            
          
!
999px
Loading ..................

Console