cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <body class="overlay black">
  <div class="container">
    <div class="v-align">

      <div class="row">
        <div class="text-center head-title spec-elite">
          <p>Random Quote Machine</p>
        </div>
        <div class="col-sm-8 col-sm-offset-2 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">
          <div class="panel panel-default">
            <div class="panel-body">
              <blockquote>
                <p id="quote"></p>
                <footer id="author"></footer>
              </blockquote>
              <a class="tweet-quote" id="tweetBtn" target="_blank"><i class="fa fa-twitter fa-2x" aria-hidden="true"></i>Tweet it</a>
            </div>
          </div>


          <div class="text-center">
            <button type="button" class="button" id="newQuote"><span class="btn-overlay">Next Quote</span></button>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
            
          
!
            
              /* Google fonts */
.spec-elite {
  font-family: 'Special Elite', cursive;
  font-size: 45px;
  text-shadow: 2px 2px 4px black;
}

body {
  /*   background: url("https://i.imgur.com/ZczpatL.jpg") no-repeat center center fixed;  */
  background: url('https://images.unsplash.com/photo-1473773508845-188df298d2d1?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&s=69b4e9aa5ba392b92c28eff906787604') no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  background-size: cover;
  color: #fff;
}

.overlay {
  position: inherit;
}


/* Overlay */

.overlay:before {
  position: absolute;
  top: 0;
  left: 0;
  content: ' ';
  width: 100%;
  height: 100%;
  display: block;
  z-index: -1;
}

.black:before {
  background-color: rgba(0, 0, 0, .4);
}

.head-title {
  margin-bottom: 30px;
}


/* Blockquote Styling for quote */

blockquote {
  font-family: Georgia, serif;
  font-size: 18px;
  font-style: italic;
  width: 100%;
  margin: 0.25em 50px 10px 0.25em;
/*   margin: 0.25em 0; */
  padding: 0.35em 40px;
  line-height: 1.45;
  position: relative;
  color: #383838;
}

a {
  color: orange;
}

.tweet-quote {
  color: #7ad2ff;
  float:right;
  transition: color 0.3s ease-in-out;
}
.tweet-quote:hover {
  color: #ff9800;
  float:right;
}

/* Displays large quotation */

blockquote:before {
  display: block;
  padding-left: 10px;
  content: "\201C";
  font-size: 80px;
  position: absolute;
  left: -20px;
  top: -20px;
  color: #7a7a7a;
}


/* Next Quote Button */

.button {
  background-color: #00900c;
  outline: none;
  border: none;
  padding: 18px;
  transition: all 0.28s ease-in-out;
}

.button:hover {
  box-shadow: inset 0 0 100px 100px rgba(255, 255, 255, 0.21);
  border: none;
}


/* Center Content */

.v-align {
  position: fixed;
  top: 25%;
  left: 0;
  right: 0;
}
            
          
!
            
              function getQuotes() {
  $.ajax({
    headers: {
      'X-Mashape-Key': 'lh5l2SOignmshW025FRifTEyD96Qp1oLkTRjsnToUpeAPBAH3Z',
      'Content-Type': 'application/x-www-form-urlencoded',
      Accept: 'application/json'
    },
    url: 'https://andruxnet-random-famous-quotes.p.mashape.com/?cat=famous',
    success: function(data) {
      var d = JSON.parse(data);
      var quote = d.quote;
      var author = d.author;

      $('#tweetBtn').attr('href', 'https://twitter.com/intent/tweet?text=' + encodeURIComponent('\"' + d.quote + '\" - ' + d.author));
      
      $("#quote").animate({
        opacity: 0
      }, 350, function() {
        $(this).animate({
          opacity: 1
        }, 350);
        $("#quote").text(d.quote);
      });

      $("#author").animate({
        opacity: 0
      }, 350, function() {
        $(this).animate({
          opacity: 1
        }, 350);
        $("#author").text(d.author);
      })

    }

  });
}

$(document).ready(function() {
  getQuotes();
  $("#newQuote").on('click', getQuotes);

  $('#tweetBtn').on('click', function() {
      openUrl('https://twitter.com/intent/tweet?text=' + encodeURIComponent('\"' + quote + '\" - ' + author));
  });

});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console