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.

            
              <div class="container">
  <div class="row">
    
    <div class="small-12">
      <div class="card">
        <div class="card-image slow">
          <img id="image">
          <h3 id="author"></h3>
        </div>
        <div class="card-content">
          <h5 id="text"></h5>
          <small>
            <p id="episode"></p>
          </small>
        </div>
        <div class="card-actions">
          <button id="quote">new quote</button>
          <a id="tweet" href="#" target="_blank" rel="noopener noreferrer">
            <i class="fa fa-twitter fa-lg"></i>
          </a>
          <a id="share" href="#" target="_blank" rel="noopener noreferrer">
            <i class="fa fa-facebook-official fa-lg"></i>
          </a>
        </div>
      </div>
    </div>
    
  </div>
</div>

<footer>
  <a href="https://github.com/bomholtm/fcc" target="_blank" rel="noopener noreferrer"><i class="fa fa-github-alt fa-lg"></i> bomholtm / fcc</a>
</footer>

<div id="preload">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/711_clerk.jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/bender(1).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/bender(2).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/bender(3).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/bender(4).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/bender(5).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/hermes_conrad.jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/hubert_j_farnsworth(1).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/hubert_j_farnsworth(2).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/hubert_j_farnsworth(3).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/john_a_zoidberg.jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/lrrr.jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/phillip_j_fry(1).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/phillip_j_fry(2).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/phillip_j_fry(3).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/phillip_j_fry(4).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/phillip_j_fry(5).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/turanga_leela(1).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/turanga_leela(2).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/turanga_leela(3).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/zapp_brannigan(1).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/zapp_brannigan(2).jpg" width="1" height="1">
  <img src="https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/zapp_brannigan(3).jpg" width="1" height="1">
</div>

            
          
!
            
              @import url("https://fonts.googleapis.com/css?family=Open+Sans|Roboto:500")

#preload
  display: none

html, body
  background-color: #3ba6c7
  height: 100%
  
a:focus, a:hover, a:visited
  text-decoration: none

.container
  display: table
  height: 100%
  margin-bottom: -42px
  min-height: 100%
  min-width: 100%
  table-layout: fixed
  width: 100%
  &:after
    content: ""
    display: block
    height: 42px
  
.row
  display: table-cell
  padding: 0 10px
  vertical-align: middle
  width: 100%
  
.card
  background-color: #fff
  background-clip: padding-box
  border-radius: 2px 2px
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)
  box-sizing: border-box
  font-family: "Open Sans", sans-serif
  font-weight: 400
  margin: 10px auto 52px
  max-width: 480px
  
  .card-image
    overflow: hidden
    position: relative
    
    img
      background-clip: padding-box
      border-radius: 2px 2px 0 0
      position: relative
          
    h3
      bottom: 0
      color: #fff
      left: 0
      line-height: 100%
      margin: 0
      padding: 16px
      position: absolute
      text-shadow: 0 1px 5px rgba(0, 0, 0, 1)
      text-transform: uppercase
      
  .card-content
    height: 150px
    padding: 16px
    position: relative
    
    #text
      color: #212121
      
    #episode
      bottom: 0
      color: #9e9e9e
      position: absolute
      right: 16px
      
  .card-actions
    background-color: #fff
    border-top: 1px solid rgba(160, 160, 160, 0.2)
    border-radius: 0 0 2px 2px
    padding: 16px
    line-height: 20px
    
    #quote
      background: none
      border: none
      color: #ed4984
      font-family: "Roboto", sans-serif
      font-size: 14px
      font-weight: 500
      outline: none
      text-transform: uppercase
      -webkit-tap-highlight-color: transparent
      
    #tweet
      color: #9e9e9e
      float: right
      &:hover
        color: #ed4984
      
    #share
      color: #9e9e9e
      float: right
      padding-right: 16px
      &:hover
        color: #ed4984
        text-decoration: none
      
footer
  background-color: #3479a5
  bottom: 0
  font-family: "Roboto", sans-serif
  font-weight: 500
  height: 42px
  width: 100%
  text-align: center
  
  a
    color: #ccdee8
    line-height: 42px
    position: relative
    top: 2px
    &:focus
      color: #ccdee8
    &:hover
      color: #ccdee8
    &:visited
      color: #ccdee8
    
    .fa-lg
      vertical-align: text-top
      margin-right: 4px
        
            
          
!
            
              $(document).ready(function(){
  var quotes = [];
  $.getJSON("https://rawgit.com/bomholtm/fcc/master/_assets/CODEPEN/random_quote_machine/quotes.json", function(data){
    quotes = data;
    newQuote();
  });
  var i = 0;
  var j;
  $("#quote").on("click", function(){
    newQuote();
  });
  function newQuote(){
    i = Math.floor(Math.random()*quotes.length);
    if(i === j){
      while(i === j){
        i = Math.floor(Math.random()*quotes.length);
      }
    }
    j = i;
    getQuote(i);
  }
  function getQuote(){
    var $image = $(".card-image");
    $("#image").attr("src", quotes[i].image);
    $("#author").html(quotes[i].author);
    $("#text").html(quotes[i].text);
    $("#episode").html(quotes[i].episode);
    $("#share").attr("href", "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent("https://codepen.io/bomholtm/full/beeRYb"));
    $("#tweet").attr("href", "https://twitter.com/intent/tweet?text=" + "\"" + quotes[i].text + "\" - " + quotes[i].author);    
    MotionUI.animateIn($image, "fade-in");
  }
});

            
          
!
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