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.

            
              <body>
  <div class="container">
    <button id="menu-toggle" class="menu-toggle"><span>Menu</span></button>
    <div id="theSidebar" class="sidebar">

 <a href="#" class="close-button close-button--show" id="bars"><i class="fa fa-close"></i></a>     
<h1 id="title"><i class="fa fa-fire codrops-links"></i>camper news</h1>                      
          <ul id="toggle">
        <li>
            <div class="active border">
                <span class="menu-icons fa fa-home"></span>   <a href="https://www.freecodecamp.com" target="_blank">home</a>
            </div>
        </li>

        <li>
            <div>
                <span class="menu-icons  fa fa-user"></span>   <a href="https://www.wired.com/2015/06/can-real-world-work-free-coding-boot-camp/" target="_blank">about </a>
                <span class="the-btn fa fa-plus"></span>
                </div>

            <ul>
                <li>
                    <a href="https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/List-of-Free-Code-Camp-city-based-Campsites">our camp sites</a>
                </li>

                <li>
                    <a href="http://www.kopernik.ngo/partner/free-code-camp" target="_blank">a partner</a>
                </li>
            </ul>

        </li>

        <li>
            <div>
                <span class="menu-icons  fa fa-briefcase"></span>
                    <a href="https://www.freecodecamp.com/anthonygallina1" target="_blank">porfolio &nbsp;</a><span class="the-btn fa fa-plus"></span>
            </div>

            <ul>
                <li>
                    <a href="http://www.fullstackwebdesign.net/blog.html" target="_blank">full stack design</a>
                </li>

                <li>
                    <a href="http://fightteam.fullstackwebdesign.net" target="_blank">social network CMS design</a>
                </li>
            </ul>
        </li>

        <li>
            <div>
                <span class="menu-icons  fa fa-news"></span>
                      <a href="https://www.freecodecamp.com/news" target="_blank">camper news</a>
            </div>
        </li>
    </ul>
      </nav>
    </div>                                                    
    <div id="theGrid" class="main">
      <section class="grid">
        <header class="top-bar">
           <a href="#" class="toggle-sidebar canvass" id="bars"><i class="fa fa-bars"></i></a> 
          <h2 class="top-bar__headline">&nbsp; Menu</h2>
          <div class="freecodecampnews">
            <span>Free Code Camp news by:Campers</span>
          </div>
        </header>                             
                                              <a id="campernews"></a>				       
        <footer class="page-meta">
          
        </footer>
      </section>
              <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
              <script src="js/newsappend.js"></script>          
</div>
</div>              
</body>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Raleway);
@font-face {
  font-weight: normal;
  font-style: normal;
}
*, *:after, *:before {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
body {
  background: #fff;
  color: #443c35;
  font-weight: 400;
  font-size: 16px;
  font-family:'Raleway', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overflow-y: scroll;
  /* force scroll to appear */
}
/* close button (for content and sidebar) */
.close-button {
  position: absolute;
  border: none;
  background: white;
  margin: 0;
  z-index: 100;
  top: 0;
  right: 0;
  font-size: 38px;
  color: white;
  cursor: pointer;
  pointer-events: none;
  padding: 20px 30px;
  opacity: 0;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.close-button span {
  display: none;
}

.close-button:hover {
  color: #7b7b7b;
}

/* show class for content close button */
.close-button--show {
  opacity: 1;
  pointer-events: auto;
}

/* helper class when showing content */
.noscroll {
  overflow: hidden;
}

a {
  outline: none;
  color: #35281d;
  text-decoration: none;
}

a:hover,
a:focus {
  color: #b93105;
  outline: none;
}

button:focus {
  outline: none;
}
#canvas {
    width: 100%;
    height: 100%;
    padding: 5.5% 0;
    position: relative;
}

/* Sidebar */
.sidebar {
/*  HIDE SIDE BAR  */
  display: none;
}

.showSidebar {
  /* SHOW SIDE BAR */
  text-align: center;
  background: #A6373F;
  z-index: 1000;
  position: fixed;
  width: 300px;
  max-width: 100%;
  height: 100%;
  height: 100vh;
  top: 0;
  left: 0;
  padding: 2em 1em;


}

.sidebar h1 {
  margin: 0.75em 0 0;
  font-size: 2em;
  line-height: 1;
  font-family:'Raleway', sans-serif;;
}

.sidebar h1 span {
  display: block;
}

.related {
  font-size: 0.85em;
  padding-bottom: 1em;
}

.related h3 {
  margin: 3em 0 0.5em 0;
  font-size: 0.95em;
}

.related a {
  display: block;
  color: inherit;
}

.related a:hover,
.related a:focus {
  color: #414741;
}

/* Main content */
.main {
  position: relative;
  z-index: 50;
  -vendor-animation-duration: 3s;
}

/* Grid container */
.grid {
  position: relative;
}

/* Overlay */
.grid::after {
  content: '';
  background: rgba(202, 202, 202, 0.4);
  opacity: 0;
  position: absolute;
  pointer-events: none;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;

}

/* Top bar above the grid */
.top-bar {
  background: #fff;
  width: 100%;
  line-height: 1;
  padding: 15px 15px 10px;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
}

.top-bar__headline {
  margin: 0;
  font-size: 0.75em;
}

/* Menu button for toggling the sidebar (appears on small screen) */
.menu-toggle {
  position: fixed;
  z-index: 100;
  display: block;
  width: 50px;
  height: 50px;
  top: 14px;
  left: 0px;
  cursor: pointer;
  background: none;
  border: none;
  display: none;
  margin: -2px 15px 0 0;
}

.menu-toggle span {
  position: absolute;
  top: 50%;
  left: 0;
  display: block;
  width: 100%;
  height: 2px;
  background-color: #81c483;
  font-size: 0px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
   user-select: none;
}

.menu-toggle span:before,
.menu-toggle span:after {
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  background: #81c483;
  content: '';
}


#toggle {
    list-style: none;
    margin-top: 40px;
    text-align: left;
}
#toggle div:hover {
    background: rgba(0,0,0,0.2);
	-webkit-box-shadow:inset 0 -1px rgba(0,0,0,0);
        -moz-box-shadow:inset 0 -1px rgba(0,0,0,0);
        box-shadow:inset 0 -1px rgba(0,0,0,0);
	color: #fff;
}
#toggle div.active {
    background: #bb4a4a;
}
#toggle div {

    cursor: pointer;
    display: block;
    border-bottom: 1px solid rgba(0,0,0,0.2);
}


/* Free Code Camp news right */
.freecodecampnews {
  text-align: right;
  font-size: 0.85em;
  margin-left: auto;
}


/* Grid item */
.grid__item {
  padding: 45px 55px 30px;
  position: relative;
  color: inherit;
  background: #fff;
  min-height: 300px;
  cursor: pointer;
  text-align: center;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-direction: normal;
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-justify-content: center;
  justify-content: center;
}

/* Grid item "border" */
.grid__item::before {
  position: absolute;
  content: '';
  top: 0px;
  right: 55px;
  bottom: 0px;
  left: 55px;
  border-bottom: 1px solid rgba(74, 74, 74, 0.075);
}

.grid__item * {
  z-index: 10;
}

/* grid item element and full content element styles */
.title {
  margin: 0;
  font-size: 1.875em;
  font-family: 'Raleway', sans-serif;
  text-align: center;
}

.title--preview {
  -webkit-flex: 1;
  flex: 1;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  width: 100%;
}

.category {
  margin: 0;
  position: relative;
  font-size: 0.95em;
  font-style: italic;
  font-family:'Raleway', sans-serif;;
  text-align: center;
  display: block;
}

.grid__item .category {
  -webkit-transition-delay: 0s;
  transition-delay: 0s;
}

.meta {
  font-size: 0.765em;
  text-align: left;
}

.meta .fa {
  margin-right: 4px;
}

.meta:before, .meta:after {
  display: table;
  content: '';
}

.meta:after {
  clear: both;
}

.meta__avatar {
  display: block;
  border-radius: 50%;
  margin: 2em auto;
}

.meta--preview .meta__avatar {
  -webkit-freecodecampnews: grayscale(50%);
  freecodecampnews: grayscale(50%);
}

.grid__item:hover .meta--preview .meta__avatar,
.grid__item:focus .meta--preview .meta__avatar {
  -webkit-freecodecampnews: none;
  freecodecampnews: none;
}

.meta__date,
.meta__reading-time {
  display: block;
  float: left;
  color: #aaa;
}

.meta__reading-time {
  text-align: right;
  float: right;
}

.meta__misc {
  display: block;
  clear: both;
  text-align: left;
  padding: 5px 0;
}

.meta__misc--seperator {
  padding: 20px 0 0;
  margin: 65px 0 0;
  border-top: 1px solid #f5f5f5;
}

.article-nav {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
}

.article-nav button {
  border: none;
  color: #81c483;
  background: none;
}

.article-nav button:hover {
  color: #333;
}

/* Grid footer */
.page-meta {
  width: 100%;
  background: #fff;
  width: 100%;
  padding: 15px 15px 10px;
  text-align: center;
  font-size: 0.75em;
  font-weight: bold;
  cursor: default;
}


/* main content */
.content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  height: 0;
  /* Avoid second scroll bar in Chrome! */
  visibility: hidden;
  z-index: 400;
  overflow: hidden;
}

.content.content--show {
  height: 100vh;
  pointer-events: auto;
  visibility: visible;
}

/* scroll helper wrap */
.scroll-wrap {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  z-index: 1;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}

/* single content item */
.content__item {
  position: absolute;
  top: 0;
  width: 100%;
  overflow: hidden;
  height: 0;
  opacity: 0;
  padding: 60px 60px 80px 60px;
  pointer-events: none;
  font-size: 0.85em;
}


/* content elements */
.category--full {
  font-size: 1.25em;
  margin-bottom: 20px;
  color: #81c483;
}

.title--full {
  font-size: 3.25em;
}

.meta--full {
  font-size: 1em;
  margin: 0 auto 2em;
  max-width: 1200px;
}
.meta--full .meta__author {
  display: block;
  text-align: center;
  font-weight: bold;
  margin-bottom: 20px;
}
.meta--full .meta__author::before {
  content: 'by ';
  font-weight: normal;
}
.meta--full .meta__category {
  font-style: italic;
  float: left;
  margin: 0 5px;
  font-family: 'Raleway', sans-serif;
}
.meta--full .meta__category::before {
  content: "in ";
}
.meta--full .meta__avatar {
  margin: 1em auto;
}


/* close button (for content and sidebar) */
.close-button {
  position: absolute;
  border: none;
  background: none;
  margin: 0;
  z-index: 100;
  top: 0;
  right: 0;
  font-size: 23px;
  color: #a07171;
  cursor: pointer;
  pointer-events: none;
  padding: 15px 30px;
}

.close-button span {
  display: none;
}

.close-button:hover {
  color: #f6f6f6;
}

/* show class for content close button */
.close-button--show {
  opacity: 1;
  pointer-events: auto;
}

/* Viewport sizes based on column number and sidebar */
/* 1 column */
/* 2 columns */
/* 3 columns */
/* 4 columns */
/* 5 columns */
/* 6 columns */

@media screen and (min-width: 600px) {
  html,
  body,
  .container,
  .main {
    height: 100vh;
  }
/* margin left 0n page load 2pixel */
  .transitionLeft2pixelmain {
    height: 100%;
    margin-left: 300px;
  }
/*margin left 0n Javascript load 300pixel for page transition */
  .main {
    height: 100%;
    margin-left: 2px;
  }

  .content__item {
    font-size: 1em;
  }

  .grid__item {
    padding: 45px 45px 30px;
  }

 
@media screen and (min-width: 900px) {
  .grid {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
   .position {
   float: right;
   width: 70px;
   white-space: nowrap;

}

  }

  /* 2 columns */
  .grid__item {
    width: 50%;
    border: none;
  }

  .grid__item::before {
    top: 5px;
    right: 5px;
    bottom: 5px;
    left: 5px;
    border: 1px solid rgba(74, 74, 74, 0.075);
    -webkit-transition: opacity 0.3s;
    transition: opacity 0.3s;
  }

  .grid__item:hover::before,
  .grid__item:focus::before {
    border: 3px solid rgba(52.5, 0, 3.9, 0.7);
  }

  .grid__item--loading.grid__item::before {
    opacity: 0;
  }
.position {
   float: right;
   width: 100%;


}
}
@media screen and (min-width: 1200px) {
  /* 3 columns */
  .grid__item {
    width: 33.333%;
    .position {
    float: right;


  }
}
@media screen and (min-width: 1500px) {
  /* 4 columns */
  .grid__item {
    width: 25%;
   float: right;
  }
}
@media screen and (min-width: 1800px) {
  /* 5 columns */
  .grid__item {
    width: 20%;
  }
}
@media screen and (min-width: 2100px) {
  /* 6 columns */
  .grid__item {
    width: 16.66%;
  }
}
/* small screen changes for sidebar  */
@media screen and (max-width: 599px) {
  

  .top-bar {
    padding: 22px 15px 10px 60px;
  }

  .menu-toggle {
    display: inline-block;
  }

  .sidebar .close-button {
    opacity: 1;
    pointer-events: auto;
  }

  .title--full {
    font-size: 2em;
  }

  .content__item {
    padding: 80px 20px 40px;
  }

  .content .close-button {
    padding: 10px 20px;
  }

  .content .close-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    background: #fff;
    border-bottom: 1px solid #f5f5f5;
    width: 100vw;
    height: 50px;
    pointer-events: none;
    z-index: -1;
  }
}


            
          
!
            
              $(document).ready(function() {

  var API_CALL = "https://www.freecodecamp.com/stories/hot";
  var stories = [];

  var Story = function(image, headline, link, upvotesCount, author) {
    this.image = image;
    this.headline = headline;
    this.link = link;
    this.upvotesCount = upvotesCount;
    this.author = author
  }

  function populateList() {
    $.getJSON(API_CALL, function(results) {
      if (results != null && results.length > 0) {
        for (res of results) {
          var imgURL = res.image != "" ? res.image : res.author.picture;
          var aStory = new Story(imgURL, res.headline, res.link, res.upVotes.length, res.author.username);
          stories.push(aStory);
        }
        updateUI();
      }

    });

  }

  function updateUI() {
  var storyBoard = $("#campernews");
    storyBoard.empty();
  for (var story of stories) {
     storyBoard.append(
     `<a class="grid__item position" href="${story.link}" target="_blank">
                    <h2 class="title title--preview">${story.headline}</h2><br>
      		    <span class="category center">view full story</span>
      		<div class="meta meta--preview">
      		  <img class="meta__avatar center" src="${story.image}" width="110" height="110" />
                 <span class="meta__reading-time"><i class="fa fa-clock-o"></i> ${story.upvotesCount} Upvotes</span>
                 <span>&nbsp; ${story.author}</span></p>
      		</div>
      </a>`);
    }
  }

  populateList();

});
   // Calling the function
   $(function() {
    $('.toggle-sidebar').click(function() {
        toggleSidebar();
    });
   // The toggleSidebar function itself
   function toggleSidebar() {
    if ($('#theGrid').hasClass('main')) {
        // Remove 2px main
        $('#theGrid').removeClass('main');
        $('#theGrid').addClass('transitionLeft2pixelmain');
        // Remove sidebar
        $('#theSidebar').removeClass('sidebar');
        //Add 300 px left for menu Add showSidebar and animate class
        $('#theSidebar').addClass('showSidebar animated flipInY');
    }
}
});

   // Calling the function
   $(function() {
    $('.close-button').click(function() {
        closeSidebar();
    });
   // The toggleNav function itself
   function closeSidebar() {
    if ($('#close-button').hasClass('close-button--show')) {
        // Remove 2px main
        $('#theGrid').removeClass('transitionLeft2pixelmain');
        // Remove sidebar
        $('#theSidebar').removeClass('showSidebar animated flipInY');
    }
    else {
        //Add 300 px left for menu Add showSidebar and animate class
        $('#theGrid').addClass('main');
        //Add sidebar and animated class
        $('#theSidebar').addClass('sidebar'); 
        
    }
}
});
// side bar drop down menu
$("#toggle > li > div").click(function () {
    if (false == $(this).next().is(':visible')) {
        $('#toggle ul').slideUp();
    }

    var $currIcon=$(this).find("span.the-btn");

    $("span.the-btn").not($currIcon).addClass('fa-plus').removeClass('fa-minus');

    $currIcon.toggleClass('fa-minus fa-plus');

    $(this).next().slideToggle();

    $("#toggle > li > div").removeClass("active");
    $(this).addClass('active');

}); 


            
          
!
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