cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

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.

            
              <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

  <title>Quotomat: Enjoy random Quotes</title>
</head>
<body>
<content>


  <div class="container-fluid" id = "quotebox">
    <h1 class="row" id = "quotomat">
        Quotomat
      </h1>


      <div class="row quote" id = "quote">

    </div>

    <div class="row" id = "author">

   </div>

   <div class = "row" id = "buttons">
          <div class = "col-sm-3" >

     </div>
     
           <div class = "col-sm-3" id = "newq">

      <button id="getQuote" class="btn btn-primary text-center">Get new Quote</button>
     </div>
     <div class = "col-sm-3" id = "tweet">

                <button onclick="tweetIt()" class="btn btn-primary text-center">Tweet it!</button>

     </div>

     <div class = "col-sm-3" >

     </div>


  </div>


</content>
</body>  
            
          
!
            
              * {
  margin: 0;
  padding: 0;
  border: 0;
}

body {
    position: relative;
    overflow-x: hidden;
  font-size: 100%;
}

html, body {
  height: 100%;
  background-color: orange;
}

#quotebox {
    border-radius: 20px;
    width: 580px;

    height: 350px;
    background-color: white;
    position: absolute;
    top:0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    box-shadow: 4px 2.25px;
 }


#quotomat {

   font-family: 'Open Sans', sans-serif;
   font-size: 3em;
   margin:  5px 2px 5px 2px;
   padding:  5px 2px 5px 2px;
   text-align: center;
   height: 30px;
}

#quote {
    margin:  20px 2px 5px 2px;
    padding:  5px 2px 5px 2px;
    font-family: 'Open Sans', sans-serif;
    font-size: 2.2em;
  font-style: italic;
  height: 180px;

}

#author {
  margin:  5px 2px 5px 2px;
  padding: 5px 2px 20px 2px;
  font-family: 'Open Sans', sans-serif;
  font-size: 2em;
  height: 30px;
  text-align: right;
  font-style: bold;
}

#buttons {
 margin:  10px 2px 10px 2px;
  padding: 10px 2px 10px 2px;
height:30px;
  font-size: 1.25em;
}

#tweet {
  padding:  1px 1px 1px 1px;
 text-align: center;
  font-size: 1.25em;
}

#newq {
padding:  1px 1px 1px 1px;
 text-align: center;
  font-size: 1.25em;
}
            
          
!
            
              $(document).ready(function() {
    //after button is clicked we download the data
    $('#getQuote').click(function(){
         //start ajax request
        $('#quote').empty();
        $('#author').empty();

        $.ajax({

           dataType: 'jsonp',

           url: "https://api.forismatic.com/api/1.0/?method=getQuote&key=457653&format=jsonp&lang=en&jsonp=?",
           error: function (jqXHR, textStatus, errorThrown) {
               console.log(jqXHR)
           },
           success: function (data) {

               console.log(data);
               var $quote = data.quoteText;
               console.log(data.quoteText);
               $('#quote').append($quote);
               var $author = data.quoteAuthor;
               console.log(data.quoteAuthor);
               $('#author').append($author);

           }
       });

     });

});

function tweetIt() {
  var quote = document.getElementById('quote').innerText;
  var author = document.getElementById('author').innerText;
  var tweetUrl = 'https://twitter.com/share?text=' + encodeURIComponent(quote) + ' ' + encodeURIComponent(author);

  window.open(tweetUrl);
}

            
          
!
999px
Loading ..................

Console