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">
  <h1 class="text-center">Random Quote Machine</h1>
  <div class="container-fluid quote-display" id="quote-display">
    <!--   quote will display here -->
    <p></p>
  </div>
  <div class="container text-center ">
    <button class="btn btn-primary" id="quote-button">New Quote</button>
    <i id="tweet-button" class="fa fa-twitter fa-2x"> </i>
  </div>
  <div id="log"></div>
  <footer class="footer fixed-bottom">
    <div class="container text-center">

      <div>
        <a href="https://codepen.io/dreamsniper/" target="_blank"><i class="fa fa-codepen fa-3x" aria-hidden="true"></i></a>
        <a href="https://www.facebook.com/steven.taveras1" target="_blank"><i class="fa fa-facebook-official fa-3x" aria-hidden="true"></i></a>
        <a href="https://twitter.com/TheDreamsniper" target="_blank"><i class="fa fa-twitter-square fa-3x" aria-hidden="true"></i></a>
        <a href="https://github.com/dreamsniper" target="_blank"><i class="fa fa-github-square fa-3x" aria-hidden="true"></i></a>
        <a href="https://www.linkedin.com/in/steven-taveras-81475b75/" target="_blank"><i class="fa fa-linkedin-square fa-3x" aria-hidden="true"></i></a>
        <a href="https://plus.google.com/u/0/+StevenTaveras_dreamsniper" target="_blank"><i class="fa fa-google-plus-square fa-3x" aria-hidden="true"></i></a>
        <a href="https://www.youtube.com/channel/UCFVYSh4PC84c34Etdagmc1Q" target="_blank"><i class="fa fa-youtube-square fa-3x" aria-hidden="true"></i></a>
        <a href="https://forum.freecodecamp.com/users/dreamsniper/summary" target="_blank"><i class="fa fa-free-code-camp fa-3x" aria-hidden="true"></i></a>

      </div>
      <p>Copyright &copy; 2017 Steven Taveras for <a href="www.freecodecamp.com">Freecodecamp.com</a></p>
      <a href="www.steventaveras.com">www.steventaveras.com</a>
    </div>

  </footer>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Tangerine|Righteous|Archivo+Black|Cormorant+Garamond');
html {
  min-height: 100%;
}
body {
  /* Margin bottom by footer height */
  margin-bottom: 60px;
  background: url('http://www.planwallpaper.com/static/images/backgrounds_2.jpg')
    no-repeat
    center
    center
    fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  .container {
    height: 100%;
  }
  h1 {
    font-family: 'Tangerine', serif;
    text-shadow: 4px 4px 4px #000;
    color: #fff;
    font-size: 4em;
    padding: .5em;
  }
  button {
    font-family: 'Cormorant Garamond', serif;
    background-color: #fff;
    font-size: 1em;
    border-radius: 10px;
    width: 25%;
  }
  .quote-display {
    font-family: cursive;
    //text-shadow: 4px 4px 4px #38423a;
    background-color: rgba(0, 0, 0, .3);
    color: #fff;
    width: 80%;
    height: 100%;
    margin: 1em auto;
    border-radius: 15px;
    box-shadow: 0 2px 2px -2px #aaa;
    p {
      font-family: 'Righteous', sans-serif;
      font-size: 1.2em;
      padding: .5em;
    }
  }
  footer {
    color: #fff;
    margin: 1em auto 1em auto;
    a {
      color: #ADD8E6;
      margin: 0 auto;
    }
  }
  i {
    color: #fff;
    margin: 0 auto;
    &:hover {
      color: #f00;
    }
  }
}

              
            
!

JS

              
                //variables___________________________
var quoteButton;
var quoteBox;
var currentQuote;
var randomNumber;
var html;
// var quotes = [
//   {
//     author: "Princess Diana",
//     quote:
//       "Carry out a random act of kindness, with no expectation of reward, safe in the knowledge that one day someone might do the same for you.",
//     source: "www.brainyquote.com"
//   },
//   {
//     author: "Helen Mirren",
//     quote:
//       "I don't believe that if you do good, good things will happen. Everything is completely accidental and random. Sometimes bad things happen to very good people and sometimes good things happen to bad people. But at least if you try to do good things, then you're spending your time doing something worthwhile.",
//     source: "www.brainyquote.com"
//   },
//   {
//     author: "Steve Jobs",
//     quote: "I believe life is an intelligent thing: that things aren't random.",
//     source: "www.brainyquote.com"
//   },
//   {
//     author: "Albert Camus",
//     quote:
//       "It is necessary to fall in love... if only to provide an alibi for all the random despair you are going to feel anyway.",
//     source: "www.brainyquote.com"
//   }
// ];

//initialize_______________________________
// quoteButton = document.getElementById("quote-button");
// quoteButton.addEventListener("click", changeQuote, false);
// quoteBox = document.getElementById("quote-display");

//functions________________________________
// function changeQuote(){
//   'use strict';

//   html = "";
//   randomNumber = Math.floor(Math.random() *quotes.length);
//   html += '<p>"' + quotes[randomNumber].quote + '"</p>';
//   html += '<p> - ' + quotes[randomNumber].author + '</p>';
//   html += '<p>' + quotes[randomNumber].source + '</p>';
//   quoteBox.innerHTML = html;
//   currentQuote = quotes[randomNumber].quote + " -" + quotes[randomNumber].author;
// }

//uodates quoteBox
function update(response) {
  'use strict';
  
  html = "";
  html += '<p>"' + response.quoteText + '"</p>';
  html += "<p> - " + response.quoteAuthor + "</p>";
  html += "<a href='" + response.quoteLink + "' target = '_blank'>" + response.quoteLink + "</a>";
  
  $('#quote-display').append(html);
  currentQuote = response.quoteText + " -" + response.quoteAuthor;
}

//incase of error
function error(jqxhr, textStatus, err) {
  console.log("Request Failed: " + textStatus + ", " + err);
}

//tweet button pressed function
$("#tweet-button").click(function() {
  window.open("https://twitter.com/intent/tweet?text=" + currentQuote);
});


//gets json from web and performs function
$("#quote-button").click(function() {
  $('#quote-display').html("");
  //using forismatic api
  $.getJSON("https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?").done(update).fail(error);
});

              
            
!
999px

Console