css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <body onload="initEB();">
<div id="ad">
		<div id="banner">
        
         <div class="button all btnNoVideo" onclick="javascript:handleClickthroughButtonClickNoVideo();"></div>
        
        <div class="button top btnVideo" onclick="javascript:handleClickthroughButtonClick();"></div>
        
        <div class="button bottom btnVideo" onclick="javascript:handleClickthroughButtonClick();"></div>
        
        <div class="element cast_1"></div>
        <div class="element cast_2"></div>
        <div class="element cast_3"></div>
        <div class="element cast_4"></div>
        
        <div class="element tag_1"></div>
        <div class="element tag_2"></div>
        <div class="element tag_3"></div>
        <div class="element tag_4"></div>
        
        <div class="element quote_1"></div>
        <div class="element quote_2"></div>
        <div class="element quote_3"></div>
        
         <div class="element keyart_image"></div>
         <div class="element key_title"></div>
         <div class="element keyart_director"></div>
         
          <div class="element date"></div>
          <div class="element book"></div>
          
          <div class="element title_end"></div>
          
          <div class="element logos"></div>
        
            
			<div id="videoContainer" class="video-container video-position">
				<video id="video" controls poster="http://episodedesign.com/digital/2016/while_we-re_young/mpu/video/WWY_20sec_MPU.jpg">
					<source src="http://episodedesign.com/digital/2016/while_we-re_young/mpu/video/WWY_20sec_MPU.mp4" type="video/mp4">
					<source src="hhttp://episodedesign.com/digital/2016/while_we-re_young/mpu/video/WWY_20sec_MPU.webm" type="video/webm">
                    <source src="http://episodedesign.com/digital/2016/while_we-re_young/mpu/video/WWY_20sec_MPU.ogv" type="video/ogg">
					Your browser does not support the <code>video</code> element.
				</video>
			</div>
            
			</div><!--banner-->
		</div><!--ad-->
</body>
            
          
!
            
              body {
  font-family: Arial, sans-serif;
  margin:0px;
  background:black;
}

#ad{
   display: block;
   overflow:hidden;
   width: 300px;
   height: 250px;
  margin: 20px auto;
   -moz-user-select: -moz-none;
   -khtml-user-select: none;
   -webkit-user-select: none;
   -ms-user-select: none;
   user-select: none;
   background: #e37d0e; /* Old browsers */

background: -moz-radial-gradient(center, ellipse cover,  #e37d0e 0%, #de5a00 100%); /* FF3.6+ */

background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,#e37d0e), color-stop(100%,#de5a00)); /* Chrome,Safari4+ */

background: -webkit-radial-gradient(center, ellipse cover,  #e37d0e 0%,#de5a00 100%); /* Chrome10+,Safari5.1+ */

background: -o-radial-gradient(center, ellipse cover,  #e37d0e 0%,#de5a00 100%); /* Opera 12+ */

background: -ms-radial-gradient(center, ellipse cover,  #e37d0e 0%,#de5a00 100%); /* IE10+ */

background: radial-gradient(ellipse at center,  #e37d0e 0%,#de5a00 100%); /* W3C */

filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e37d0e', endColorstr='#de5a00',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */


}

#banner{
  position:absolute;
  display: block;
  width: 300px;
  height: 250px;
  overflow: hidden;
}

/*BUTTON*/

.button {
	height: 250px;
	position: absolute;
	z-index: 10;
	
}

.btnNoVideo {
	z-index: 200;
	
}

.btnVideo {
	display: none;
}

.all {
	width: 300px;
}


.top, .bottom {
	left: 0;
	width: 300px;
}

.top {
	height: 43px;
	top: 0;
}

.bottom {
	height: 39px;
	bottom: 0;
}

/*VIDEO*/

.video-container {
  height: 168px;
  position: absolute;
  width: 300px;
	background-color: #000;
	opacity: 0;
}
.video-position {
  margin: auto;
  position: absolute;
  left: 0px;
  top: 43px;
}

video {
  height: 100%;
  width: 100%;
	z-index: 100;
}

#video {

	z-index: 100;
	position: absolute;
	
}

/*ELEMENTS*/

.element {
	background-repeat: no-repeat;
	position: absolute;
	top: 0;
	left: 0;
	opacity: 0;
}

.cast_1, .cast_2, .cast_3, .cast_4 {
	width: 240px;
	height: 35px;
	left: 30px;
}

.cast_1 {
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/cast_names_1_ben.png);
	top: 30px;
	
}
.cast_2 {
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/cast_names_2_naomi.png);
	top: 70px;
	
}
.cast_3 {
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/cast_names_3_amandea.png);
	top: 115px;
	
}
.cast_4 {
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/cast_names_4_adam.png);
	top: 159px;
	
}

.tag_1, .tag_2, .tag_3 {
	width: 250px;
	height: 30px;
	left: 25px;
}

.tag_1 {
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/tag_line_1_comedy.png);
	top: 15px;
	
}
.tag_2 {
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/tag_line_2_director.png);
	top: 60px;
}
.tag_3 {
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/tag_line_3_franceha.png);
	top: 101px;
}
.tag_4 {
	width: 140px;
	height: 50px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/quote_heyyouguys.png);
	top: 154px;
	left: 80px;
}

.quote_1 {
	width: 140px;
	height: 50px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/quote_telegraph.png);
	top: 5px;
	left: 80px;
}
.quote_2 {
	width: 155px;
	height: 75px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/quote_grazia.png);
	left: 72px;
	top: 77px;
}
.quote_3 {
	width: 180px;
	height: 50px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/quote_guardian.png);
	left: 60px;
	top: 170px;
}

.keyart_image {
	width: 300px;
	height: 210px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/key-art.jpg);
}
.key_title {
	width: 300px;
	height: 210px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/key-art_TT.png);
}
.keyart_director {
	width: 115px;
	height: 30px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/txt_director.png);
	left: 92px;
	top: 7px;
}

.date {
	width: 230px;
	height: 25px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/date_april.png);
	left: 35px;
	top: 216px;
	
}
.book {width: 225px;
	height: 25px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/book_tickets.png);
	top: 216px;
	left: 37px;

}

.title_end {
	width: 270px;
	height: 35px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/title_one_line.png);
	left: 15px;
	top: 5px;
}

.logos {
	width: 300px;
	height: 15px;
	background-image: url(http://episodedesign.com/digital/2016/while_we-re_young/mpu/images/logos.png);
	top: 235px;
	opacity: 1;
}
            
          
!
            
              //GreenSock

var element = document.getElementsByClassName('element');

var cast1 = document.getElementsByClassName('cast_1');
var cast2 = document.getElementsByClassName('cast_2');
var cast3 = document.getElementsByClassName('cast_3');
var cast4 = document.getElementsByClassName('cast_4');

var tag1 = document.getElementsByClassName('tag_1');
var tag2 = document.getElementsByClassName('tag_2');
var tag3 = document.getElementsByClassName('tag_3');
var tag4 = document.getElementsByClassName('tag_4');

var quote1 = document.getElementsByClassName('quote_1');
var quote2 = document.getElementsByClassName('quote_2');
var quote3 = document.getElementsByClassName('quote_3');

var keyartImage = document.getElementsByClassName('keyart_image');
var keyTitle = document.getElementsByClassName('key_title');
var keyartDirector = document.getElementsByClassName('keyart_director');
 
var date = document.getElementsByClassName('date');
var book = document.getElementsByClassName('book');
  
var titleEnd = document.getElementsByClassName('title_end');
  
var logos = document.getElementsByClassName('logos');

var videoBox  = document.getElementsByClassName('video_box ');
var videoContainer = document.getElementsByClassName('video-container'); 




function resetStart() {
TweenMax.to(element, 0, {transformOrigin:"50% 50%"});
TweenMax.to(cast1, 0, {left:"-=280px"});
TweenMax.to(cast2, 0, {left:"+=280px"});
TweenMax.to(cast3, 0, {left:"-=280px"});
TweenMax.to(cast4, 0, {left:"+=280px"});

TweenMax.to(tag1, 0, {left:"-=300px"});
TweenMax.to(tag2, 0, {left:"+=300px"});
TweenMax.to(tag3, 0, {left:"-=300px"});
TweenMax.to(tag4, 0, {left:"+=300px"});

TweenMax.to(quote1, 0, {left:"-=300px"});
TweenMax.to(quote2, 0, {left:"+=300px"});
TweenMax.to(quote3, 0, {left:"-=300px"});

TweenMax.to(keyartImage, 0, {alpha:0});
TweenMax.to(keyTitle, 0, {alpha:0});
TweenMax.to(keyartDirector, 0, {top:"-=50px"});

TweenMax.to(date, 0, {alpha:0});
TweenMax.to(book, 0, {alpha:0});

TweenMax.to(titleEnd, 0, {left:"-=300px"});

TweenMax.to(videoContainer, 0, {left:"+=300px"});

}


function swapDate() {
	TweenMax.to(book, 0.4, {alpha:0});
	TweenMax.to(date, 0.4, {alpha:1, delay:0.5});
	TweenMax.delayedCall(3,swapBook);
	
}

function swapBook() {
	TweenMax.to(date, 0.4, {alpha:0});
	TweenMax.to(book, 0.4, {alpha:1, delay:0.5});
	TweenMax.delayedCall(3,swapDate);
}

function frame01() {
	TweenMax.to(cast1, 0, {alpha:1});
	TweenMax.to(cast2, 0, {alpha:1});
	TweenMax.to(cast3, 0, {alpha:1});
	TweenMax.to(cast4, 0, {alpha:1});
	
	TweenMax.to(cast1, 0.4, {left:"+=280px"});
TweenMax.to(cast2, 0.4, {left:"-=280px", delay:0.25});
TweenMax.to(cast3, 0.4, {left:"+=280px", delay:0.5});
TweenMax.to(cast4, 0.4, {left:"-=280px", delay:0.75});
	TweenMax.delayedCall(2,frame02);
}

function frame02() {
	TweenMax.to(cast1, 0.4, {left:"+=280px"});
TweenMax.to(cast2, 0.4, {left:"-=280px"});
TweenMax.to(cast3, 0.4, {left:"+=280px"});
TweenMax.to(cast4, 0.4, {left:"-=280px"});
	TweenMax.delayedCall(0.5,frame03);
}

function frame03() {
	TweenMax.to(tag1, 0, {alpha:1});
	TweenMax.to(tag2, 0, {alpha:1});
	TweenMax.to(tag3, 0, {alpha:1});
	TweenMax.to(tag4, 0, {alpha:1});
	
TweenMax.to(tag1, 0.4, {left:"+=300px"});
TweenMax.to(tag2, 0.4, {left:"-=300px", delay:0.25});
TweenMax.to(tag3, 0.4, {left:"+=300px", delay:0.5});
TweenMax.to(tag4, 0.4, {left:"-=300px", delay:0.75});
TweenMax.delayedCall(2,frame04);
}

function frame04() {
TweenMax.to(tag1, 0.4, {left:"-=300px"});
TweenMax.to(tag2, 0.4, {left:"+=300px"});
TweenMax.to(tag3, 0.4, {left:"-=300px"});
TweenMax.to(tag4, 0.4, {left:"+=300px"});
TweenMax.delayedCall(0.5,frame05);
}

function frame05() {
	TweenMax.to(quote1, 0, {alpha:1});
	TweenMax.to(quote2, 0, {alpha:1});
	TweenMax.to(quote3, 0, {alpha:1});

TweenMax.to(quote1, 0.4, {left:"+=300px"});
TweenMax.to(quote2, 0.4, {left:"-=300px", delay:0.25});
TweenMax.to(quote3, 0.4, {left:"+=300px", delay:0.5});

TweenMax.delayedCall(2,frame06);
}

function frame06() {

TweenMax.to(quote1, 0.4, {left:"+=300px"});
TweenMax.to(quote2, 0.4, {left:"-=300px"});
TweenMax.to(quote3, 0.4, {left:"+=300px"});

TweenMax.delayedCall(0.5,frame07);
}

function frame07() {
	
	TweenMax.to(keyartDirector, 0, {alpha:1});
	
	TweenMax.to(keyartImage, 0.4, {alpha:1});
TweenMax.to(keyTitle, 0.4, {alpha:1, delay:0.4});
TweenMax.to(keyartDirector, 0.4, {top:"+=50px", delay:0.8});

TweenMax.delayedCall(1,swapDate);

TweenMax.delayedCall(3.5,frame08);
}

function frame08() {
	TweenMax.to(keyartImage, 0.4, {alpha:0});
TweenMax.to(keyTitle, 0.4, {alpha:0});
TweenMax.to(keyartDirector, 0.4, {alpha:0});

TweenMax.delayedCall(0.5,frame09);
}



function frame09() {
	
	TweenMax.to(videoContainer, 0, {alpha:1});
	
	TweenMax.to(titleEnd, 0, {alpha:1});
	TweenMax.to(titleEnd, 0.4, {left:"+=300px"});
	
	TweenMax.to(videoContainer, 0.5, {left:"-=300px", alpha:1, delay:0.5});
	TweenMax.delayedCall(1,frame10);
}

function frame10() {
	$(".btnNoVideo").hide();
	$(".btnVideo").show();
	TweenMax.to(videoContainer, 0, {alpha:1});
	video = document.getElementById("video");
		initVideo();
}

	var video;
	
	function initEB(){
	
			resetStart();
			frame01();
			startAd();

	}
	
	function startAd() {
		document.getElementById("banner").style.visibility = "visible";
	}
	
	function initVideo() {
		var videoTrackingModule = new EBG.VideoModule(video);
	}
	
	function handleClickthroughButtonClick() {
		video.pause();
		EB.clickthrough();
	}
	
	function handleClickthroughButtonClickNoVideo() {
		EB.clickthrough();
	}
	
	function handleUserActionButtonClick() {

	}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console