css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              <link href="https://fonts.googleapis.com/css?family=Comfortaa:700" rel="stylesheet">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"/>

<body class="container-fluid text-center">
  <div class="background">
    <div class="main">
      <h1 id="newQuote">Press the button below for your motivational quote of the day!</hi>
    </div>

    <div id="button">
      <button class="btn btn-primary" id="generate">Motivate me!</button>
      <a id="tweet" href=# target="_blank"><img src="http://icons.iconarchive.com/icons/uiconstock/socialmedia/256/Twitter-icon.png" /></a>
    </div>
</body>
  
<footer>
  <p>Code by <a href="https://github.com/Grixxs" target="_blank">Grixs</a></p>
</footer>
  

            
          
!
            
              body {
  background-color: #ff1065;
}

footer {
  color: white;
  margin-top: 50px;
}

.btn {
  margin: 5px
}

.main {
  margin-top: 10%;
  margin-bottom: 50px;
  padding-left: 100px;
  padding-right: 100px;
  color: white;
  font-family: 'Comfortaa', cursive;
}

img {
  width: 35px;
  height: 35px;
}
            
          
!
            
              function setBackground() {
  const colors = ['#cc0099','#cc0000','#99e600','#66ff66','#00e673','#00cc99','#cc00cc','#8A2BE2', '#0088cc', '#6666ff', '#a64dff', '#ff1065'];
  return colors[Math.floor(Math.random() * colors.length)] + 'cc';
}

function generateQuote() {
  const quotes = [
['"Time\s up, let\'s do this."', ' - Leeroy Jenkins'],
                
['"If at first you don\'t succeed, it\'s probably because you weren\'t good enough in the first place."', ' - Grixs'],
                
['"You can be replaced."', ' - Mayur Gala'],
                
['"It probably will get worse."', ' - James Douglas'],
                
['"Dream. Only to escape the miserable reality of your life."', ' - Dominik Schröder'],
                
['"Don\'t cry because it\'s over, smile because if you don\'t everyone will ask you what\'s wrong."', ' - Alex Wigan'],
                
['"Burn it. Burn it all."', ' - Anonymous'],
                
['"If you can stay calm, while all around you is chaos…then you probably haven\’t completely understood the seriousness of the situation."', ' - Alexander / via positivesharing.com'],
                
['"You could probably be doing better..."', ' - The World'],

['"Every corpse on Mount Everest was at one time a very, very motivated person."', ' - by lukianp / via reddit.com'],
                
['"Those who doubt your ability probably have a valid reason."', ' - Luke Pamer'],
                
['"Life is not a fairytale. If you lose your shoe at midnight, you\'re drunk"', ' - Aleksandra Boguslawska'],
               
['"Whenever you feel insignificant, just remember...you are."', ' - Anonymous'],
               
['"Ew."', ' - everyone']
    ];
  
  const quoteArray = quotes[Math.floor(Math.random() * quotes.length)];
  const quote = quoteArray[0];
  const author = quoteArray[1];
  return quoteArray;
};

$(document).ready(function() {
 $(".btn-primary").bind("click",function() {
    $("body").css("background-color", setBackground())
  });
  
  $("#generate").bind("click", function() {
    var quoteGenerated = generateQuote()
    var urlQuote = 'http://twitter.com/intent/tweet?text=' + encodeURIComponent(quoteGenerated[0] + quoteGenerated[1])
    $("#newQuote").html(quoteGenerated[0] + '<br /><h5><em>' + quoteGenerated[1] + '</em></h5>')
    $("#tweet").attr('href', urlQuote)
  });  
});

//https://twitter.com/intent/tweet?text=

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

Console