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-fluid">
<div class="card text-center card-outline-muted quote-box">
<div class="row">
<div class="col-sm-10 offset-sm-1">
  <div class="h5 quote-text">
    <i class="fa fa-quote-left"></i> <span id="text"></span> <i class="fa fa-quote-right"></i>
  </div>
   <div class="lead quote-author">- <span id="author"></span> </div>
</div>
</div>
  <div class="row justify-content-between quote-box-button-group">
    <div class="col-sm-5 offset-sm-1">
    <a class="btn btn-danger quote-box-button" id="tweet-quote" title="Tweet this quote!" target="_blank"> <i class="fa fa-twitter"></i> Share</a>
    </div>
    <div class="col-sm-5 offset-sm-1">
      <button class="btn btn-danger quote-box-button" id="new-quote"> <i class="fa fa-refresh"></i> </button>
    </div>
  </div>
</div>
<div class="footer text-center"> by <a href="https://codepen.io/bitscaa/">Bitscaa</a></div>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Raleway:400,500);
@import url(https://fonts.googleapis.com/css?family=Lobster:400,500);

body {
  background: url("http://www.vectortiles.com/wp-content/uploads/sky-and-cloud-patterns-05-600x600.jpg") center center;
}

div .card {
  background: white;
}

.quote-box {
  margin: 5em 2em 2em 2em;
  padding: 2em;
}

.quote-text {
  font-family: "Raleway";
} 

.quote-author {
  font-family: "Lobster";
}

.quote-box-button-group {
  margin-top: 0.5em;
  margin-bottom: -0.5em;
}

.quote-box-button {
  margin: 0.5em;
}

.footer, .footer * {
  color: white;
}
              
            
!

JS

              
                function inIframe() {
  try {
    return window.self !== window.top;
  } catch (e) {
    return true;
  }
}

var colors = ['#16a085', '#27ae60', '#2c3e50', '#f39c12', '#e74c3c', '#9b59b6', '#FB6964', '#342224', "#472E32", "#BDBB99", "#77B1A9", "#73A857"];

var currentQuote = '',
  currentAuthor = '';

function openURL(url) {
  window.open(url, 'Share');
}

function getQuote() {
  $.ajax({
    url: 'https://andruxnet-random-famous-quotes.p.mashape.com/?cat=famous',
    type: 'GET', // The HTTP Method, can be GET POST PUT DELETE etc
    data: {}, // Additional parameters here
    // dataType: 'json',
    success: function(response) {
      // var r = JSON.parse(response);
      var r = response;
      currentQuote = r.quote;
      currentAuthor = r.author;
      if (inIframe()) {
        $('#tweet-quote').attr('href', 'https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=' + encodeURIComponent('"' + currentQuote + '" ' + currentAuthor));
      }
      $(".quote-text").animate({
          opacity: 0
        },
        function() {
          $(this).animate({
            opacity: 1
          });
          $('#text').text(r.quote);
        });

      $(".quote-author").animate({
          opacity: 0
        },
        function() {
          $(this).animate({
            opacity: 1
          });
          $('#author').html(r.author);
        });

      var color = Math.floor(Math.random() * colors.length);
      $("html body").animate({
        // backgroundColor: colors[color],
        color: colors[color]
      }, 1000);
      $(".btn").animate({
        // backgroundColor: colors[color]
      }, 1000);

    },
    error: function(err) {
      alert(err);
    },
    beforeSend: function(xhr) {
      xhr.setRequestHeader("X-Mashape-Authorization", "OivH71yd3tmshl9YKzFH7BTzBVRQp1RaKLajsnafgL2aPsfP9V"); // Enter here your Mashape key   /* Key by Gabriel Nunes */
    }

  });
}

function getQuoteAnimatedDone() {
  $(".card").removeClass("animated bounceOut");
}

$(document).ready(function() {
  getQuote();
  $('#new-quote').on('click', function() {
    $(".card").addClass("animated bounceOut");
    setTimeout(function() { getQuote(); }, 1000);
    setTimeout(function() { getQuoteAnimatedDone(); }, 3000);
  });
  $('#tweet-quote').on('click', function() {
    openURL('https://twitter.com/intent/tweet?hashtags=quotes&related=freecodecamp&text=' + encodeURIComponent('"' + currentQuote + '" - ' + currentAuthor));
  });
  $('#tumblr-quote').on('click', function() {
    openURL('https://www.tumblr.com/widgets/share/tool?posttype=quote&tags=quotes,freecodecamp&caption=' + encodeURIComponent(currentAuthor) + '&content=' + encodeURIComponent(currentQuote));
  });
});
              
            
!
999px

Console