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

              
                
<body>

<div class="container-fluid" id="scotch">
<nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <ul class="nav navbar-nav">
                <!--<li class="pull-left"><a href="#">Dashboard</a></li>-->
                <li class="active" id="all"><a href="#">All</a></li>
                <li id="online"><a href="#" >Online</a></li>
                <li id="offline"><a href="#" >Offline</a></li>
                <!--<li class="social pull-right"><a href="#">Social Links</a></li>-->
            </ul>
        </div>
    </div>
</nav>

    <!--<div class="row">-->
        <!--<div class="col-xs-4 first">test</div>-->
        <!--<div class="col-xs-4">test</div>-->
        <!--<div class="col-xs-4">test</div>-->
    <!--</div>-->

</div>

</body>
</html>
              
            
!

CSS

              
                
html { font-size: 62.5%; }

body {


    padding-top: 2rem;

}

#scotch {

    /*arbitrary size, i was looking for something under 320px that would have a centered navbar in bootstrap and this worked*/
    max-width: 29rem;
    margin: auto;
    overflow: hidden;
    border-radius: 0.45rem 0.45rem;
    padding: 0;
    /*FONT SIZE SHOULD CHANGE ACCORDING TO MEDIA */


    /*padding: 1rem;*/


}

.row {

    display: flex;
    text-align: center;
    font-size: 1rem;
    /*margin: 0;*/
    /*padding: 0.5rem;*/
    border-top: solid 2px white;
    /*flex-wrap: nowrap;*/
    /*text-align: left;*/
    margin: 0;

}

.row > * {

    /*margin: 0;*/
    /*padding: 0;*/
    text-align: center;
    width: 50%;
    margin: auto;



}

#name {
    padding-left: 0;


  }



/*NOT SURE IF THIS IS WORKING*/
#icon {

    padding-right: 0;
}

/*.first {*/

    /*text-align: center;*/

/*}*/

.container-fluid {


}

.navbar {

    /*should change this later*/
    margin-bottom: 0;
    border-radius: 0.45rem 0.45rem 0 0;
}

.navbar-nav {

    /*position: absolute;*/
    width: 100%;
    /*margin-left: 2.5%;*/
    /*margin-right: 5%;*/
    text-align: center;
}
.navbar-nav > li {
      float: none;
      display: inline-block;
  }

img {

    width: 32px;
    height: 32px;
    margin: 8px 0 8px 0;
    text-align: left;

}

div #name {

}

/******COLOR*******/

.row {

    /*background-color: #66afe9;*/
    background-color: #5e5e5e;
    color: #fff;

}

.online #streaming  {

    background-color: #436117;

}

.offline #streaming  {

    background-color: #B61B1B;


}

a {

    color: #fff;
    text-decoration: none;

}





              
            
!

JS

              
                $(document).ready()
{
    var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "brunofin"];
    getChannelInfo();

    $("li").click(function() {
        $("li").removeClass("active");
        $(this).addClass("active");

        var status = $(this).attr('id');

            console.log(status);

        if ( status === 'online' )  {

            $('.offline').addClass("hidden");
            $('.online').removeClass("hidden");


        } else if (status === 'offline')
        {
            $('.offline').removeClass("hidden");
            $('.online').addClass("hidden");

        } else if (status === 'all') {

            $('.online').removeClass("hidden");
            $('.offline').removeClass("hidden");

        }


    });



};
/*document ready ends here */






    function getChannelInfo() {
        channels.forEach(function(channel) {
            $.getJSON(makeURL("streams", channel), function(data) {

                var game, status;
                if (data.stream === null) {
                    game = "Offline";
                    status = "offline";
                } else if (data.stream === undefined) {

                    game = "Account Closed / Non-Existent";
                    status = "offline";

                } else {
                    game = data.stream.game;
                    status = "online";

                }

                $.getJSON(makeURL("channels", channel), function(data) {

                    var logo, name, description

                    if (data.logo != null) {
                        logo = data.logo;
                    } else {
                        logo = "https://dummyimage.com/50x50/ecf0e7/5c5457.jpg&text=0x3F";
                    }

                    if (data.display_name != null) {
                        name = data.display_name;
                    } else {
                        name = channel;
                    }

                    if (status === "online") {
                        description = ': ' + data.status;

                    } else {

                        description = "";
                    }

                    var html = '<div class="row first ' +
                    status + '"><div class="col-xs-2" id="icon"><img src="' +
                    logo + '" class="logo"></div><div class="col-xs-6" id="name"><a href="' +
                            data.url + '" target="_blank">' +
                            name + '</a></div><div class="col-xs-4" id="streaming">' +
                            game; //'<span class="hidden-xs">' + description + '</span></div></div>';

                    //console.log(status + ": " + html);

                    status === "online" ? $("#scotch").append(html) : $("#scotch").append(html);


                });

            });




        });



    };

    function makeURL(type, name) {

        return 'https://api.twitch.tv/kraken/' + type + '/' + name + '?callback=?';


    };








              
            
!
999px

Console