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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <div class="container-fluid">
  <div class="row">
    <div class="col-sm-6 col-sm-offset-3 container-box">
      <div class="quote-box">
        <p class="quote"><span class="quotemarks">"</span><span class="quoteline">Quote to go here, and it could be quite long, or even longer...</span><span class="quotemarks">"</span></p>
        <p class="author">author</p>
      </div>
      <div class="social-panel row">
        <div class="col-sm-6 social-links"><a target="_blank" href="" class ="twitter-share-button" data-size="large"><img src="https://res.cloudinary.com/nhast25cs/image/upload/v1517237212/twitter-white_acmkrf.png"> Tweet this quote!</a></div>
      <div class="col-sm-6 quote-button"><button id="nextQuote" class="button btn-lg">New Quote</button></div>
      </div>
      <p class="copyright text-center">Random quote generator by <a href="https://twitter.com/nicki_hastings">@Nicki_Hastings</a></p>
    </div>
    
  </div>
</div>
              
            
!

CSS

              
                body{
  background-color: #ddd;
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 1.5em;
}
.container{
  text-align: center;
  
}
.container-box{
  margin-top:4em;
  display: inline-block;
  background-color: #555;
  border-radius: 12px;
  padding: 2em 2em 1em 2em;
  -webkit-transition: background-color 0.75s ease-out;
  -moz-transition: background-color 0.75s ease-out;
  -o-transition: background-color 0.75s ease-out;
  transition: background-color 0.75s ease-out;
}

.quote-box{
  border:5px solid #fff;
  border-radius: 12px;
  padding: 2em;
  color: #fff;
}

.quote{
  font-size: 3em;
  font-family: 'Open Sans', sans-serif;
  font-weight: 300;
  font-style: italic;
  margin-bottom: 20px;
}

.quotemarks{
  font-family: 'Times New Roman', sans-serif;
  font-style: italic;
}

.author{
  text-align: right;
  font-size: 1.3em;
  font-weight: 300;
}
.author:before{
  content: '-';
  display: inline-block;
  margin-right: 5px;
}

.social-panel{
  margin-top: 2em;
  color: #fff;
}
img { 
  margin-right: 0.5em;
}
.social-links{
  font-size: 1.15em;
  padding-top: 5px;
}
a, a:hover{color: #FFF;}
a:hover,a:visited, a:focus{
  text-decoration: none;
  color: #fff;
}
.quote-button{
  text-align: right;
}
.button{
  color: #555;
}
.copyright{
  color: #fff;
  margin-top: 3em;
  font-size: 90%;
}
              
            
!

JS

              
                $(document).ready(function(){
  //get the quote api information with Ajax
  getQuote();
  var bgCols = ['#2e67f7','#ea5c30','#38b582','#683a20','#59357d', '#555'];
  
  function getQuote(){
    var num = Math.floor(Math.random()*6+1);
  $.ajax({
    url: "https://andruxnet-random-famous-quotes.p.mashape.com/?cat=movies&count=1",
    type: "GET",
    data: {},
    dataType: "json",
    beforeSend: function(xhr) {
      xhr.setRequestHeader("X-Mashape-Authorization", "xYdGlgmLb6mshjBkNyNcbyQpGZuLp17o5c4jsnMmdf7VIAQut0"); // My Mashape key
    },  
    success: function (data){
      $('.quoteline').html(data.quote);
      $('.author').html(data.author);
      $('.twitter-share-button').attr("href",'https://twitter.com/intent/tweet?text='+ encodeURIComponent(data.quote) + encodeURIComponent(' Movie: ') + encodeURIComponent(data.author) + encodeURIComponent(' #FreeCodeCamp #RandomQuoteGenerator') + '&via=Nicki_Hastings');
      $('.container-box').css('background-color', bgCols[num]);
      },
    error: function(err) { console.log("Failure!..."); console.log(err); }
   });
  }
  
  

 $("#nextQuote").on("click", function(e){
    e.preventDefault();
    getQuote();
 });
  
});
              
            
!
999px

Console