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.

            
              <div class="color-container container text-center">
  <div class="row">
    <div class="col-xs-12">
      <div class="random-quote">
        <header>
          <h2 style="color: #555;"><b><u>Random Quotes</u></b></h2>
        </header>
        <blockquote>
          <h3 id="quote"></h3>
          <footer>
            <cite id="sayer"></cite>
          </footer>
        </blockquote>
        <footer>
          <a id="tweetbutton" class="btn btn-primary">Tweet This Quote</a>
          <button id="random" class="btn btn-success">Get a Quote</button>
        </footer>
      </div>
    </div>
  </div>
</div>
</div>
            
          
!
            
              body {
  background-color: blue;
}


.random-quote {
  border-radius: 5px;
  background-color: white;
  height: 300px;
  width: 600px;
  margin-top: 100px;
  margin-left: auto;
  margin-right: auto;
  border-style: solid;
  border-width: 3px;
}


h3 {
  font-family: serif;
}

h3:before {
  font-famaly: serif;
  content: open-quote;
  font-weight: bold;
  font-size: 50px;
  color: #889c0b;
}
            
          
!
            
              
var arr = [
  ["Whatever the mind of man can conceive and believe, it can achieve.", "Napoleon Hill"],
  ["Life is what happens to you while you’re busy making other plans.", "John Lennon"],
  ["We become what we think about.", "Earl Nightingale"],
  ["Life is 10% what happens to me and 90% of how I react to it.", "Charles Swindoll"],
  ["The most common way people give up their power is by thinking they don’t h  ave any.", "Alice Walker"],
  ["The best time to plant a tree was 20 years ago. The second best time is now.", "Chinese Proverb"],
  ["Winning isn’t everything, but wanting to win is.", "Vince Lombardi"],
  ["You can never cross the ocean until you have the courage to lose sight of the shore.", "Christopher Columbus"],
  ["The two most important days in your life are the day you are born and the day you find out why.", "Mark Twain"],
  ["People often say that motivation doesn’t last. Well, neither does bathing.  That’s why we recommend it daily.", "Zig Ziglar"],
  ["Two roads diverged in a wood, and I—I took the one less traveled by, And that has made all the difference.", "Robert Frost"],
  ["You miss 100% of the shots you don’t take.", "Wayne Gretzky"],
  ["Every strike brings me closer to the next home run.", "Babe Ruth"]
];

function randomize() {
  var randomQuote = arr[Math.floor(Math.random() * arr.length)];
  return randomQuote;
}
var quote = randomize();

function getSelectionText() {
  return "\"" + quote[0] + " -" + quote[1];
}
$(document).ready(function() {
  $("#tweetbutton").attr("href", 'https://twitter.com/intent/tweet?text=' + encodeURI(getSelectionText()) + '&url=' + encodeURI(document.URL));
  $("#tweetbutton").attr("target", '_blank');

  $("#quote").html(quote[0]);
  $("#sayer").html(quote[1]);

  $("#random").click(function() {
    var quote = randomize();
    $("#quote").html(quote[0]);
    $("#sayer").html(quote[1]);
    $("#tweetbutton").attr("href", 'https://twitter.com/intent/tweet?text=' + encodeURI(getSelectionText()) + '&url=' + encodeURI(document.URL));
    $("#tweetbutton").attr("target", '_blank');
  });
});
            
          
!
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