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.

            
              <a class="watch-video" data-video="https://vimeo.com/142513143" alt="PLAY"> Pop Up Video Overlay</a>
<div class="additional">
	This is a demo of writing an iframe in dynamically using data-attribute with JQuery. Also uses FitVid.js to resize the iframe to full screen.
</div>
<div class="overlay">
  <div class="close">X</div>
  <div class="rotate">
  <div class="vert-center-outer">
    <div class="vert-center-inner"></div>
  </div>
  </div>
</div>
            
          
!
            
              body {
	text-align: center;
	background: #69D2E7;
}

.watch-video {
	margin-top: 30px;
	cursor: pointer;
	padding: 20px;
	background: #F38630;
	color: white;
	display: inline-block;
	border:  5px solid #E0E4CC ;
	-moz-box-shadow:    inset 0 0 10px #F38630;
   -webkit-box-shadow: inset 0 0 10px #F38630;
   box-shadow:         inset 0 0 10px #F38630;
}
.additional {
	margin-top:40px;
	background: #A7DBD8;
	padding:20px;
	color: #333;
	border-top: 4px solid #E0E4CC;
}

.overlay {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 1000;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.8);
	overflow: auto;
	transition: all .5s;
	opacity: 0;
	-webkit-perspective: 1300px;
	-moz-perspective: 1300px;
	perspective: 1300px;
	display: none;
	.rotate {
		height: 85%;
		-webkit-transform-style: preserve-3d;
		-moz-transform-style: preserve-3d;
		transform-style: preserve-3d;
		-webkit-transform: rotateY(-70deg);
		-moz-transform: rotateY(-70deg);
		-ms-transform: rotateY(-70deg);
		transform: rotateY(-70deg);
		-webkit-transition: all .3s;
		-moz-transition: all .3s;
		transition: all .3s;
		opacity: 0
	}
}
.noscroll .overlay{
	display: block;
}
.addopacity .overlay {
    opacity: 1;
	
}
.show {
	.rotate {
		  opacity: 1;
		-webkit-transform: rotateY(0deg);
		-moz-transform: rotateY(0deg);
		-ms-transform: rotateY(0deg);
		transform: rotateY(0deg);
	}
}
.close {
	position: absolute;
	top: 20px;
	right: 20px;
	color: white;
	z-index: 101;
	cursor: pointer;
}
.vert-center-outer {
	margin-top: 30px;
	display: table;
	width: 100%;
	height: 100%;
		.vert-center-inner {
			display: table-cell;
			vertical-align: middle
		}
}
            
          
!
            
              $(document).ready(function() {
	jQuery(".watch-video").click(function() {
			var dataVideo = jQuery(this).data("video");
			
			//is it vimeo?
			if (dataVideo.indexOf("https://vimeo.com/") > -1) {
					dataVideo = dataVideo.replace("https://vimeo.com/", "https://player.vimeo.com/video/");
			}
			if (dataVideo.indexOf("https://vimeo.com/") > -1) {
					dataVideo = dataVideo.replace("https://vimeo.com/", "https://player.vimeo.com/video/");
			}
			if (dataVideo.indexOf("vimeo") > -1) {
					dataVideo = "<iframe src='" + dataVideo + "?api=1&player_id=vimeoplayer" + "' width='500' height='281' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
			}
			//write the video into the overlay and resize it
		//f.vimeocdn.com/js/froogaloop2.min.js
			jQuery(".overlay .vert-center-inner").html(dataVideo);
			jQuery(".overlay .vert-center-inner").fitVids();
			console.log(dataVideo);
			jQuery("body").addClass('noscroll');
			setTimeout(function() {
					jQuery("body").addClass('addopacity');
			}, 5);
			
			setTimeout(function() {
					jQuery("body").addClass('show');
			}, 700);
		
			/*
			setTimeout(function() {
					var iframe = document.getElementById('fitvid0');
					// $f == Froogaloop
					var player = $f(iframe);
					player.api("play");
					player.api("play");
			}, 800);
			*/

	});
	//on click close scripts
	jQuery(".overlay .close").click(function() {
			jQuery("body").removeClass('show');
			jQuery("body").removeClass('addopacity');
			setTimeout(function() {
					jQuery("body").removeClass('noscroll');
					jQuery(".overlay .vert-center-inner").html("");
					var iframe = document.getElementById('fitvid0');
					/*
					// $f == Froogaloop ,
					var player = $f(iframe);
					player.api("play");
					player.api("stop");'
					*/
			}, 500);
	});
	jQuery(".overlay").click(function() {
			jQuery("body").removeClass('show');
			jQuery("body").removeClass('addopacity');
			setTimeout(function() {
					jQuery("body").removeClass('noscroll');
					jQuery(".overlay .vert-center-inner").html("");
			}, 500);
	});
});
            
          
!
999px
Loading ..................

Console