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 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.

            
              <div class="container-fluid">
  <div class="row text-center">
    <h1>Unsolicited Advice Generator</h1>
  </div>
  <div class="row text-center textbox">
    <div class="col-xs-12">
      <p id="quote">The message will go here.</p>
      
    </div>
    <div class="row text-center">
      <div class="col-xs-12">
        <div id="getMessage" class="btn newQuote">
          <i class="fa fa-comment"></i>More Advice
        </div>
        <a id="twitter" class="btn" title="Share this quote!" target="_blank"><i class="fa fa-twitter"></i>Tweet</a>
      </div>
      
    </div>
  </div>
  
  <p class="credit text-center">Advice provided by - <a href="http://adviceslip.com/">Adviceslip.com</a></p>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Comfortaa|Paytone+One|Elsie|Raleway');
body {
  font-family: 'Comfortaa', cursive;
  font-size: 16px;
  background: #a7779f;
}

h1 {
  font-family: 'Paytone One', cursive;
  color: #fff;
  font-size: 3em;
  margin: 50px 0;
  text-transform: uppercase;
}
credit, a, a:hover {
  color: #333;
}
.textbox {
  background: #fbf2ed;
  width: 600px;
  max-width: 100%;
  margin: 0 auto;
  padding: 80px 20px;
  border: .8em double #a7779f;
}
#quote {
  font-size: 1.6em;
  margin-bottom: 50px
}
.btn {
  background-color: #60365a;
  color: #fff;
  font-size: 1.2em;
  margin: .3em 1.2em;
}
.btn.focus, .btn:focus, .btn:hover {
  color: #fff;
  background-color: #732167;
}
.fa {
  margin-right: 8px;
}
            
          
!
            
              var html = "http://api.adviceslip.com/advice";
var getQuote = function(data) {
  $("#quote").text(data["slip"]["advice"]);

  updateTweet(data);
};

//Calls a random quote
$(document).ready(function() {
  $.getJSON(html, getQuote, "jsonp");
});

// New Quote button pulls new quote
$("#getMessage").click(function() {
  $.getJSON(html, getQuote, "jsonp");
});

//Share quote to Twitter
function updateTweet(data) {
  var thisQuote = data.slip.advice;
  $("#twitter").attr(
    "href",
    "https://twitter.com/intent/tweet?text=" + thisQuote + "- via @CandiceDavidson "
  );
}

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

Console