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.

            
              <!DOCTYPE html>
<html>

<head>
  <!-- Adding necessary external scripts and styles, JQuery from Googleapis, local stylesheet, local scripts -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
  <script src="base.js"></script>
  <link rel="stylesheet" type="text/css" href="style.css">
  <link href='https://fonts.googleapis.com/css?family=Special+Elite' rel='stylesheet' type='text/css'>

  <title>Random Chuck Norris Machine</title>
  <meta charset="UTF-8">
</head>
<!-- Body section -->

<body>
  <!-- Begin chuck-main-frame-section -->

  <!-- Begin chuck-title-frame-section -->
  <article class="chuck-title">
    <!-- Begin title-elem-section -->
    <span class="chucktext">
    <img src="https://66.media.tumblr.com/4d94066620c4da466f462db9a67f8cc3/tumblr_o7mnaz71kE1qzxebgo1_540.png" width="128" class="thechuck">
    
    The Chuck Norris Random Quote Machine</span>

    <!-- End title-elem-section -->
  </article>
  <!-- End chuck-title-frame-section -->
  <!-- Begin chuck-quote-frame-section -->
  <article class="chuck-quote">
    <p>The wisdom of Chuck :</p>
    <!-- Begin quote-elem-section -->
    <p id="quote-elem"></p>
    </br>
    </br>
    <!-- End quote-elem-section -->
  </article>
  <!-- End chuck-quote-frame-section -->
  <!-- Begin chuck-button-frame-section -->
  <div class="chuck-buttons">
    <button class="new-button">New</button>
    <button class="tweet-button">Tweet</button>
  </div>
  <!-- End chuck-button-frame-section -->
  <!-- Begin chuck-blurb-frame-section -->

  <!-- Begin chuck-blurb-text-section -->
  <p id="blurb">
    </br>
    &copy; 2016 <a href="mailto:peter.svedman@gmail.com">Peter Svedman</a>
  </p>
  <!-- End chuck-blurb-text-section -->

  <!-- End chuck-blurb-frame-section -->

  <!-- End chuck-main-frame-section -->
</body>

</html>
            
          
!
            
              /* Stylesheet for Random Chuck Norris Machine */

/* Setup section */

/* Markup section */
body {
  width: 750px;
  display: block;
  margin-left: auto;
  margin-right: auto; 
}
p {
	font-size: 24px;
  font-family: 'Special Elite', cursive;
}
/* ID section */
 #quote-elem {
   width: 90%;
   margin: 0;  
   position: absolute;               /* 2 */
   top: 50%;                         /* 3 */
   transform: translate(5%, -25%) 
}   
#blurb {
 font-size: 12px; 
 width: 50%;
  margin-left: auto;
  margin-right: auto; 
  width: 90%;
  text-align: center;
}
/* Class section */
.chuck-title {
	position: relative;
	background-color: white;
	padding: 5px; 
	margin: 160px 20px 10px 20px;
	box-shadow: 5px 5px 5px;
	border: 2px solid black;
	width: 90%;
  font-family: 'Special Elite', cursive;
}
.chuck-quote {
	position: relative;
	background-color : white;
	padding: 5px;
	margin: 0px 20px 20px 20px;
	text-align: center;
	box-shadow: 5px 5px 5px;
	border: 2px solid black;
	width: 90%;
  height: 175px;
}
.chuck-buttons{
    text-align: center;
}
.thechuck {
  vertical-align: middle;
  padding: 10px;
}
.chucktext {
  font-size: 24px;
  padding: 20px;
}
.new-button {
    background-color: #FFF; 
    border: 2px solid black;
    color: black;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 24px;
	  box-shadow: 5px 5px 5px;
    font-family: 'Special Elite', cursive;
}
.tweet-button {
	background-color: #FFF;
    border: 2px solid black;
    color: black;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 24px;
	box-shadow: 5px 5px 5px;	
  font-family: 'Special Elite', cursive;
}
/* end Stylesheet */




            
          
!
            
              /* Chuck Norris sees you */
console.log("Im working just fine");
var chuckNorris = "";
var chuckStatus = "";
var threeChucked = "";

// Function fixQuote fixes the &quote problem
function fixQuote(stru) {
  return stru.split("&quot;").join("\"");
  }
// main script section
$(document).ready(function() {
	// Load a joke from the API
        $.getJSON("https://api.icndb.com/jokes/random", function(chuckNorris, chuckStatus) {
        console.log(chuckStatus);
        threeChucked = fixQuote(chuckNorris.value.joke);
        $("#quote-elem").text(threeChucked);
		 });
	  
	// On new-button click load a new joke  
	  $("button.new-button").click(function() {
        $.getJSON("https://api.icndb.com/jokes/random", function(chuckNorris, chuckStatus) {
          console.log(chuckStatus);
          threeChucked = fixQuote(chuckNorris.value.joke);
          console.log(threeChucked.length);
          $("#quote-elem").text(threeChucked);
		  $("#quote-elem").animate({paddingLeft: '25px'}, 200, 'swing');
          $("#quote-elem").animate({paddingLeft: '5px'}, 200, 'swing');
          $("#quote-elem").animate({paddingLeft: '20px'}, 200, 'swing');
          $("#quote-elem").animate({paddingLeft: '5px'}, 200, 'swing');
          $("#quote-elem").animate({paddingLeft: '15px'}, 200, 'swing');
          $("#quote-elem").animate({paddingLeft: '5px'}, 200, 'swing');
        });
      });
	  // On tweet.button click load tweet page
      $("button.tweet-button").click(function(e) {
         e.preventDefault();
		 var loc = threeChucked;
        //We trigger a new window with the Twitter dialog, in the middle of the page
         window.open('https://twitter.com/share?url=' + loc + '&text=' + threeChucked + '&', 'twitterwindow', 'height=450, width=550, top=' + ($(window).height() / 2 - 225) + ', left=' + $(window).width() / 2 + ', toolbar=0, location=0, menubar=0, directories=0, scrollbars=0');
        });
		//Animate the buttons
		$("button").mouseenter(function(){
			$(this).animate({borderWidth: '5px'}, 50, 'swing')
		});
		$("button").mouseleave(function(){
			$(this).animate({borderWidth: '2px'}, 50, 'swing')
		});
		
		
      });
            
          
!
999px
Loading ..................

Console