cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              <!DOCTCYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Cat Facts</title>
	<link rel="stylesheet" href="css/normalize.css">
	<link rel="stylesheet" href="css/bootstrap.min.css">
	<link rel="stylesheet" href="css/main.css">
	<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
</head>
<body>
	

<div class="container">
	<h1> Cat Facts </h1>
		<button class="btn btn-primary" id="fact-btn"> Learn Something About Cats </button>

		<div class="data text-center" id="fact-display">
		</div>

	<div id="tweet-container"></div> 


</div>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
  <script src="js/app.js"></script>
</body>
</html>
            
          
!
            
              body {
		background-image: url("http://git.bbeckert.com/cat_facts/img/background.jpg");
		background-repeat: no-repeat;
		background-position: right center;
		background-size: cover;
		background-color: #727272;
		color: teal;
		font-family: arial; 
}

h1 {
	font-weight: bold;
}
.main {
		margin: auto;
}

#fact-btn {
		margin: 30px auto;
		height: 5em;
		background: teal;
		color: white;
}

.data {
		margin: 1em 0;
		font-weight: bold;
		font-size: 25px;
		font-style: italic;
}

#fact-display {
	width: 650px;

}
            
          
!
            
              $(document).ready(function() {
		var url = "http://crossorigin.me/http://catfacts-api.appspot.com/api/facts?number=1?callback=JSON_CALLBACK?"
		//twitter button js
		window.twttr = (function(d, s, id) {
				var js, fjs = d.getElementsByTagName(s)[0],
						t = window.twttr || {};
				if (d.getElementById(id)) return t;
				js = d.createElement(s);
				js.id = id;
				js.src = "https://platform.twitter.com/widgets.js";
				fjs.parentNode.insertBefore(js, fjs);

				t._e = [];
				t.ready = function(f) {
						t._e.push(f);
				};

				return t;
		}(document, "script", "twitter-wjs"));

		//fact call back
		$("#fact-btn").click(function() {
			$("#tweet-container").html("");	
				$.getJSON(url, function(data) {
						fact = data.facts[0];
						$("#fact-display").html(fact);
						
			twttr.widgets.createShareButton(
				  'https://goo.gl/lqo1gR',
				  document.getElementById('tweet-container'),
				  {
				    text: fact,
				    hashtags: "cats, random, facts",
				    via: "CatFacts101",
				    count: "none"

				  }
				);
				});

				});
		});

            
          
!
999px
Loading ..................

Console