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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <!--<!DOCTYPE html>-->
<html lang="en">
<head>
	<title>Random Quotes!</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<link href="https://fonts.googleapis.com/css?famil=Lobster" rel="stylesheet" type="text/css"/>
 	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="Quote.js"></script>
</head>
<body>
	<div id="content" class="container-fluid text-center">
		<div></div>
	</div>
</body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                $(document).ready(function() {
  //widget for twitter button
  window.twttr = (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0],
      t = window.twttr || {};
    if (d.getElementById(id)) return t;
    js = d.createElement(s);
    js.id = id;
    js.src = "https://platform.twitter.com/widgets.js";
    fjs.parentNode.insertBefore(js, fjs);

    t._e = [];
    t.ready = function(f) {
      t._e.push(f);
    };

    return t;
  }(document, "script", "twitter-wjs"));
  //Create starting quote as place holder, would like to have a random quote
  //generated in the future. Works for now though.
  var quoteAppend = "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.";
  var authorAppend = 'Albert Einstein';

  //Generates the html, and changes the css attributes. I could have let
  //html and css do all the work but I was having fun messing around with
  //jQuery!
  $("#content").html("<div class='well well-sm'><div id='quoteDiv'><span id='quote'></span></div>" + "<div id='authorDiv'><span id='author'></span></div>" + "<a href='#'' id='getQuote' class='btn btn-default btn-lg'>Get Quote</a>" + "<div id='tweetBtn'><a id='tweetThis' href='https://twitter.com/share' class='twitter-share-button' data-text='thisText' data-size='large' data-hashtags='Quotes'>Tweet</a></div></well>");
  $("body").css({
    "background-color": "grey",
    "background-image": "url('http://wallpapercave.com/wp/kSQdCxM.jpg')"
  });
  $(".container-fluid").css({
    "padding-top": "10em",
    "padding-bottom": "10em"
  });
  $("div").css({
    "padding-bottom": "2em",
    "padding-top": "1em"
  });
  $("#quoteDiv").css("padding-top", "7em");
  $(".well").css({
    "background-color": "rgba(171, 205, 239, 0.2)",
    "padding-top": "2em"
  });

  //Sets the initial quote and author.
  $("#quote").html('"' + quoteAppend + '"')
    .css({
      "font-family": "Lobster",
      "font-size": "3em",
      "color": "#ccc"
    });
  $("#author").html('-' + authorAppend).css({
    "font-size": "2em",
    "color": "#ccc"
  });
  $("#tweetThis").attr("data-text", quoteAppend + "-" + authorAppend);

  //The click function that fetches the quote and author and sets them to the
  //variables.
  $("#getQuote").click(function() {

    $.getJSON("https://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&lang=en&jsonp=?", function(result) {
      var arr = $.map(result, function(el) {
        return el
      });
      quoteAppend = arr[0];
      authorAppend = arr[1];
      $("#quote").html('"' + quoteAppend + '"');
      $("#author").html('-' + authorAppend);
      //code for resetting iframe to dynamically change the twitter info
      $('#tweetBtn iframe').remove();
      var tweetBtn = $('<a></a>')
        .addClass('twitter-share-button')
        .attr('href', 'https://twitter.com/share')
        .attr('data-size', 'large')
        .attr('data-text', quoteAppend + "-" + authorAppend);
      $('#tweetBtn').append(tweetBtn);
      twttr.widgets.load();

    });

  });
});
              
            
!
999px

Console