JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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>
<title>My Quote Machine</title>
</head>
<body>
<div id="background" class="container-fluid">
<div class="row">
<h1 id="title" class="text-center text-uppercase">Random Quote Machine</h1>
</div>
<div class="row">
<div id="text" class="text-center">
Click the button to get a random quote about success.<br /> Tweet it if you find it inspiring.
</div>
</div>
<hr class="col-xs-12 intro-divider">
<div class="row">
<div id="quote" class="col-xs-8 col-xs-offset-2 text-center">
Click the button to get a random quote about success.<br /> Tweet it if you find it inspiring.
</div>
</div>
<hr class="col-xs-12 intro-divider">
<div class="row">
<div id="button1" class="text-center">
<button id="new-quote" class="btn btn-success" role="button">Get a new quote</button>
</div>
</div>
<br />
<div class="row">
<div id="tweet-container" class="text-center"></div>
</div>
</div>
</body>
html, body {
width: 100%;
height: 100%;
background: url(https://images.unsplash.com/photo-1427501482951-3da9b725be23?q=80&fm=jpg&s=f68edb15ce4565555ccf9b6395da4dff) no-repeat center center fixed;
opacity: 0.98;
width: 100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
body, h1, h2, h3, h4, h5, h6 {
font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#text{
margin-top: 25px;
font-size: 20px;
color: #FFF;
text-shadow: 0px 2px 3px #444;
}
#quote{
font-size: 27px;
color: #F00;
text-shadow: 0px 2px 3px #111;
}
#title{
font-size: 40px;
font-weight: 700;
color: #FFF;
text-shadow: 0px 2px 3px #444;
}
#button2{
margin-top: 10px;
}
var twitter_url = "https://twitter.com/intent/tweet";
var quotes = [
"Success is nothing more than a few simple disciplines, practiced every day.",
"Coming together is a beginning; keeping together is progress; working together is success.",
"Success is not final, failure is not fatal: it is the courage to continue that counts.",
"The price of success is hard work, dedication to the job at hand, and the determination that whether we win or lose, we have applied the best of ourselves to the task at hand.",
"Don't aim for success if you want it; just do what you love and believe in, and it will come naturally.",
"Always be yourself, express yourself, have faith in yourself, do not go out and look for a successful personality and duplicate it.",
"Success consists of going from failure to failure without loss of enthusiasm.",
"The starting point of all achievement is desire.",
"Man needs his difficulties because they are necessary to enjoy success.",
"Success is not the key to happiness. Happiness is the key to success. If you love what you are doing, you will be successful."
];
var number;
var quote;
$( document ).ready(function() {
$( "#new-quote" ).click(function() {
number = getRandom(0, 9);
quote = quotes[number];
$("#quote").html(quote);
$("#tweet-container").html("");
twttr.widgets.createShareButton(
"http:\/\/codepen.io\/husamp\/pen\/YyKLze",
document.getElementById("tweet-container"),
{
size: "large",
//via: "\",
text: quote
}
);
});
});
var getRandom = function (min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
Also see: Tab Triggers