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.

            
              <head>
</head>
<body id = "body" class = "container">
  
  <div id = "quote_box">  
    <div id = "quote">
      "<span id = "text"></span>"
    </div>
    <div id = "person">
      -<span id = "Author" ></span>
    </div>  
  </div>
  
  <div id = "button_box">
    <div id = "me" class = >
    <strong> by: ClassyFD</strong>
    </div> 
    <div id = "social_buttons">
      <a target="_blank" id = "twitter" class = "fa-twitter fa" title = "Tweet this quote!">
      </a>
    </div> 
    <div id = "new-quote">
      <p title = "Click for a new quote!"id = "new_quote">New quote</p>
    </div>
  </div>
</body>

            
          
!
            
              /* page body */
#body {
  background-image: url("http://backgrounds.mysitemyway.com/wp-content/uploads/2009/03/abstract-cloudy-sky-000448-blue-magenta.jpg");
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

/* box containing everything */
#quote_box {
  width:80%;
  height:300px;
  background-color:gray;
  margin: 60px auto;
  border: ridge 2px;
  box-shadow: 0px 0px 40px 6px hsl(0, 0%, 0%);
}

/* the actual quote */
#quote {
  position: relative;
  text-align:center;
  top: 10%;
  font-size: 25px;
  font-family: 'Bellefair', serif;
}

/* social media buttons  */
#social_buttons {
  position:relative;
  top: 50%;
  left: 10%;
}
#twitter {
  background: #55ACEE;
  color: white;
  padding: 20px;
  font-size: 30px;
  text-align: center;
  text-decoration: none;
  border-radius: 50%;
}
#twitter:hover {
  opacity: 0.7;
}
/* author name */
#person {
  position:relative;
  margin-top: 15%;
  float:right;
  right: 10%;
  font-family: 'Fresca', sans-serif;
}

/* place to keep the buttons without them moving around */
#button_box {
  position: absolute;
  bottom: -90px;
  margin-right: auto;
  margin-left: auto;
  left: 0px;
  right: 0px;
  background-color: darkgray;
  width: 78%;
  padding-bottom: 10px;
  border: outset 1px;
  border-top: solid white 1.4px;
  padding-top: 10px;
  box-shadow: 0px 5px 50px 6px hsl(0, 0%, 0%);
}

/* clicking takes you to another quote */
#new-quote {
  position:absolute;
  right: 70px;
  bottom: 20px;
  background-color:cyan;
  width: 100px;
  height: 50px;
  border: ridge 2px;
}
#new-quote:hover{
  opacity: 0.7;
  color:white;
  cursor:pointer;
}
#new-quote:active{
  border:groove 1px;
  
}

/* text inside the next quote box */
#new_quote {
  margin-top: 9px;
  text-align:center;
  font-family: 'Bellefair', serif;
  font-size: 20px;
  -ms-user-select: none;
   user-select: none;
}

#me {
  position:relative;
  text-align:center;
  font-size: 10px;
  
}
            
          
!
            
              function inIframe () { try { return window.self !== window.top; } catch (e) { return true; } }

var currentQuote = 'welcome to my quote generator. To get started, click the button that says (new quote)! '; 
var currentAuthor = 'Me';

function openURL(url){
  window.open(url, 'Share', 'width=550, height=400, toolbar=0, scrollbars=1 ,location=0 ,statusbar=0,menubar=0, resizable=0');
}

function getQuote() {  
  $.ajax({
    headers: {
      "X-Mashape-Key": "OivH71yd3tmshl9YKzFH7BTzBVRQp1RaKLajsnafgL2aPsfP9V",
      Accept: "application/json",
      "Content-Type": "application/x-www-form-urlencoded"
    },
    url: 'https://andruxnet-random-famous-quotes.p.mashape.com/cat=',
    success: function(r) {
      if (typeof r === 'string') {
       r = JSON.parse(r); 
      }
      currentQuote = r.quote;
      currentAuthor = r.author;
      if(inIframe())
      {
        $('#twitter').attr('href', 'https://twitter.com/intent/tweet?&related=freecodecamp&text=' + encodeURIComponent('"' + currentQuote + '" ' + currentAuthor));
  document.getElementById("text").innerHTML = currentQuote;
  document.getElementById("Author").innerHTML = currentAuthor;}
    }
  }); 
}

$(document).ready(function() {
  getQuote();
  $('#new-quote').on('click', getQuote);
  $('#twitter').on('click', function() {
    if(!inIframe()) {
      openURL('https://twitter.com/intent/tweet?&related=freecodecamp&text=' + encodeURIComponent('"' + currentQuote + '" ' + currentAuthor));
    }
  });
});

            
          
!
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