Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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">
		<div class="col-md-3 hidden-xs"></div>
<div class="col-xs-12 col-md-6 text-center" id="quote-box" style="opacity:0;" >
		<div id="quote"><i class="fa fa-2x fa-quote-left" aria-hidden="true"></i><span id="quoteText"></span><i class="fa fa-2x fa-quote-right" aria-hidden="true"></i></div>
		<div class="text-right" id="author"></div>
	<div id="buttons">
		<button id="twShare" class="btn social col-xs-2"><i class="fa fa-lg fa-twitter" aria-hidden="true"></i></button>
		<button id="tbShare" class="btn social col-xs-2"><i class="fa fa-lg fa-tumblr" aria-hidden="true"></i></button>
		<button id="newQuote" class="btn  pull-right">New Quote</button>
	</div>
	</div>
</div>
<div class="col-md-3 hidden-xs"></div>
	<footer class="text-center">by <a href="https://codepen.io/MiguelSMendoza/">Miguel S. Mendoza</a></footer>
	</div>

              
            
!

CSS

              
                body {
	margin: auto;
	background-color: gray;
}
#quote-box {

	margin:7% auto 0 auto;
	background-color: white;
	padding: 45px 55px 35px 55px;
	border-radius:10px;
}
#buttons {
	margin-top: 20px;
}
#author {
	margin-top:15px;
}
#quoteText {
	font-family: Monospace;
	font-size: 26px;
	margin-left: 5px;
	margin-right: 5px;
}
.social {
	/*width: 36px;*/
}
.btn {
	margin:2px;
	color:white;
}
.btn:focus,.btn:active {
		color: white !important;
   outline: none !important;
}
footer {
	margin-top: 10px;
	margin-bottom: 3%;
	color:white;
}
footer a, footer a:visited {
	color:white;
}
              
            
!

JS

              
                $(function() {
	$.ajaxSetup({
		headers: {
			'X-Mashape-Key': 'eYGmKQOj8dmshmJg61AzH6g8YuHDp1MnncKjsnIcYsqjXkB5YH'
		}
	});
	
	function openModal(url, winWidth, winHeight) {
		var winTop = (screen.height / 2) - (winHeight / 2);
		var winLeft = (screen.width / 2) - (winWidth / 2);	
		window.open(url, 'sharer', 'top=' + winTop + ',left=' + winLeft + ',toolbar=0,status=0,width=' + winWidth + ',height=' + winHeight);
	}

	function twitterShare(msg) {
		var status = "https://twitter.com/home?status="+msg;
		openModal(status, 520, 350);		
	}
	
	function tbShare(caption, content) {
		var tbUrl = 'https://www.tumblr.com/share?posttype=quote&tags=quotes,freecodecamp&caption='+ encodeURI(caption)+'&content='+encodeURI(content); 
		console.log(tbUrl);
		openModal(tbUrl, 520, 350);
	}

	function changeColors() {
		var rgb = [];
		for (var i = 0; i < 3; i++) {
			rgb.push(Math.floor(Math.random() * 255));
		}
		var inverted = rgb.map(function(val) {
			return 64-val;
		});
		var color = 'rgb(' + rgb.join(',') + ')';
		var colorInverted = 'rgb(' + inverted.join(',') + ')';
		$("body").animate({
			backgroundColor: color,
		}, 1000);
		$(".btn").animate({
			backgroundColor: color,
		}, 1000);
		//$(".btn").css('color', colorInverted);
		$("#quote-box").animate({
			color: color,
		}, 1000);
	}

	function getQuote() {
		$("#quote").animate({
			opacity: 0,
		}, 100);
		$.getJSON('https://andruxnet-random-famous-quotes.p.mashape.com/').done(function(data) {
			$("#quoteText").html(data.quote);
			$("#author").html(data.author);
			$("#quote").animate({
				opacity: 1,
			}, 500, function() {
				$("#quote-box").animate({
					opacity: 1
				}, 100);
			});
		});
	}
	$("#newQuote").on('click', function() {
		changeColors();
		getQuote();
	});
	$("#tbShare").on('click', function() {	tbShare($("#author").text(), $("#quoteText").text());
	});
		$("#twShare").on('click', function() {	twitterShare('"'+$("#quoteText").text()+"\" - "+$("#author").text());
	});
	$(document).ready(function() {
		changeColors();
		getQuote();
	});
});
              
            
!
999px

Console