Pen Settings



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


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


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.


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.


    <script src="" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>

    <section id="page-banner" class="bg-image" style="background-image: url('');">
      <div class="overlay">			
        <div class="inner">		
            <h1>YouTube Background Video!</h1>	
      <div class="video_wrap" style="display:none"><div id="player"></div></div>


                * { box-sizing:border-box;  }
#page-banner  { text-align:center; position:relative; background-color:#00176e; color:#ffffff; height:679px; overflow:hidden; }
.bg-image     { background-size:cover; background-position:center center; }
.overlay    { position:relative; background-color:rgba(0,23,110,.9); height:100%; width:100%; z-index:2; }
.inner      { padding-top:50px; }
  h1      { color:#ffffff; margin:0 auto; }
.video_wrap   { height:100%; width:100%; position:absolute; left:0; overflow:hidden; top:0; padding-bottom:56.5%; } 
iframe      { height:100%; position:absolute; width:100%; top:0; left:0; }


                // Loads the YouTube IFrame API JavaScript code.
var tag = document.createElement('script');
tag.src = "";
// Inserts YouTube JS code into the page.
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

var player;

// onYouTubeIframeAPIReady() is called when the IFrame API is ready to go.
function onYouTubeIframeAPIReady() {
  	player = new YT.Player('player', {
    	height: '360',
      width: '640',
      videoId: 'GquEnoqZAK0',
      playerVars: { 'autoplay': 1, 'controls': 0, 'showinfo': 0, 'rel': 0, 'enablejsapi':1, 'wmode' : 'transparent'},
      events : {
     	 	'onReady' : pkOnPlayerReady,
         'onStateChange' : pkOnPlayerStateChange

function pkOnPlayerStateChange(e) {
  	var frm = $(;
  	if ( === YT.PlayerState.ENDED) {
      if ('player' === frm.attr('id')) {
  	if ( === YT.PlayerState.BUFFERING) {
      if ('player' === frm.attr('id')) {'hd720');
function pkOnPlayerReady(e) {

//Load a youtube pixel
var pkEnableYoutube = function() {
     var deferred = jQuery.Deferred();
     var img = new Image();
     img.onload = function() { return deferred.resolve(); };
     img.onerror = function() { return deferred.reject(); };
     img.src = ""+ new Date().getTime();
     return deferred.promise();

//When the video starts to load, set a timer for the video wrap to fade in
		setTimeout(function() {
	 	}, 2000);