Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

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.

HTML

              
                <html>

<body>

<div><h3 style="color:gray; right-indent:20px">Banner with borrowed assets for testing purposes</h3>
  <div id="banner">
    <!-- for all the frames 1-5 -->
    <div class="bannerArea">

      <!-- Text headings -->
      <p id="theNew">THE NEW
        <br><span>MINI COOPER S.</span></p>
      <h1 id="smallCar">SMALL CAR</h1>
      <h1 id="bigPleasure">BIG PLEASURE</h1>


      <img id="cooper" src="http://i66.tinypic.com/2i8kxus.jpg" />
      <img id="backLight" src="http://oi67.tinypic.com/2w2ertl.jpg" />
      <img id="frontLight" src="http://oi63.tinypic.com/2z6tc2g.jpg" />
      <button id="explore" class="ExpLog">EXPLORE NOW.</button>
      <img id="chevron" class="ExpLog" src="http://i67.tinypic.com/2gwhrw1.jpg" />
      <img id="logo" class="ExpLog" src="http://i65.tinypic.com/2iuxsv9.jpg" />
      <img id="bigLogo" src="http://i65.tinypic.com/2iuxsv9.jpg" />

      <!-- change color text and buttons, these change the color of the cooper at last frame -->
      <h2 id="change"> CHANGE COLOR: </h2>
      <button class="buttons active" id="blue"></button>
      <button class="buttons" id="yellow"></button>
      <button class="buttons" id="red"></button>

      <!--frame 5 with the colors of the mini separated -->
      <img id="frontGray" src="http://i65.tinypic.com/2i9idzm.jpg" />
      <img id="frontRed" class="cooperColors" src="http://i67.tinypic.com/f27olh.jpg" />
      <img id="frontYellow" class="cooperColors" src="http://i67.tinypic.com/2jan28i.jpg" />
      <img id="frontBlue" class="cooperColors" src="http://i63.tinypic.com/2sbkc3m.jpg" />
      </div>
    
    </div>
</div>
</body>

</html>
              
            
!

CSS

              
                /*------------- main banner specs ------------*/
#banner{
  position: relative;
  float: left;
  overflow: hidden;
  width: 300px;
  height: 250px;
  background:white;
}
.bannerArea{
  position:absolute;
  overflow: hidden;
  width:300px;
  height:250px;
  color: #ffffff;
  background-color: #00a1d6;
  font-family: MGH;
}

/*------------- text and logos ----------------------*/
/* The new mini cooper s.*/
#theNew{
position: absolute;
top: -5px;
left: 20px;
font-size:20px;
}
#theNew span{
  font-size:28px;
}
#smallCar{
position: absolute;
top: 5px;
left: 20px;
font-size:18px;
}
#bigPleasure{
  position: absolute;
  top: 20px;
  left: 20px;
  font-size:28px;
}
#explore{
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: inline-block;
  width:143px;
  height:31px;
  text-align: center;
  color: #ffffff;
  background-color: #000000;
  line-height: 30px;
  text-indent: 26px;
  font-family: MGH;
  font-size: 14px;
  border: none;
}
#change{
  position:absolute;
  top: 10px;
  left: 20px;
  display: inline-block;
  color: #ffffff;
  font-family: MGH;
  font-size: 14px;
}
/* logos */
#logo{
  position: absolute;
  right: 0px;
  bottom: -12px;
  display: inline-block;
  width:33%;
  height: auto;
}
#bigLogo{
  position: absolute;
  width: 100%;
  height: auto;
}
#chevron{
  position:absolute;
  top: 219px;
  left: 20px;
  width:20px;
  height: auto;
}

/* ----Cooper side  and lights-------- */
#cooper{
      position: absolute;
      width:94%;
      height: auto;
      left:9px;
      top: 4px;
}
#backLight{
  top: 113px;
  left: 18px;
  height: auto;
width: 16%;
  position: absolute;
}
#frontLight{
  top: 114px;
  right: 13px;
  height: auto;
  width: 26%;
  position: absolute;
}

/* ---------blue,yellow,red button ----------- */
.buttons {
  position: absolute;
  top: 20px;
  display: inline-block;
  width:20px;
  height:20px;
  cursor: pointer;
  border: none;
}
.buttons:hover,
.buttons:active, .active{
  box-shadow: inset 0 0 1px 2px white;
  visibility: hidden;
}

/* ----------- button gradient for different browsers for the three buttons ----------------- */
#blue{
    left: 145px;
    background: -webkit-linear-gradient(#00a1d6 0%, #55b7d6 50% , #00a1d6 0%); /* For Safari 5.1 to 6.0 */
    background: -o-linear-gradient(#00a1d6 0%, #55b7d6 50% , #00a1d6 0%); /* For Opera 11.1 to 12.0 */
    background: -moz-linear-gradient(#00a1d6 0%, #55b7d6 50% , #00a1d6 0%); /* For Firefox 3.6 to 15 */
    background: linear-gradient(#00a1d6 0%, #55b7d6 50% , #00a1d6 0%); /* Standard syntax */
  }
#yellow{
  left: 171px;
  background: -webkit-linear-gradient(#e48d19 0%, #eda445 50% , #e48d19 0%); /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(#e48d19 0%, #eda445 50% , #e48d19 0%); /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(#e48d19 0%, #eda445 50% , #e48d19 0%); /* For Firefox 3.6 to 15 */
  background: linear-gradient(#e48d19 0%, #eda445 50% , #e48d19 0%); /* Standard syntax */
}
#red{
  left: 197px;
  background: -webkit-linear-gradient(#8f0f16 0%, #a63d41 50% , #8f0f16 0%); /* For Safari 5.1 to 6.0 */
  background: -o-linear-gradient(#8f0f16 0%, #a63d41 50% , #8f0f16 0%); /* For Opera 11.1 to 12.0 */
  background: -moz-linear-gradient(#8f0f16 0%, #a63d41 50% , #8f0f16 0%); /* For Firefox 3.6 to 15 */
  background: linear-gradient(#8f0f16 0%, #a63d41 50% , #8f0f16 0%); /* Standard syntax */
}

/* --------- car colors and position for the last frame --------------- */
#frontGray,
#frontBlue,
#frontYellow,
#frontRed{
  position: absolute;
  top: 43px;
  width:100%;
}

              
            
!

JS

              
                var theNew = $("#theNew"),              //Mini Cooper S. text
    smallCar = $("#smallCar"),          //Small car text
    bigPleasure = $("#bigPleasure"),    //big pleasure text
    cooper = $("#cooper"),              //Cooper side image
    logo = $("#logo"),                  //small cooper logo
    bigLogo = $("#bigLogo"),            //big cooper logo
    bannerArea = $(".bannerArea"),      //for frames 1-3
    change = $("#change"),              //change color text
    buttons = $(".buttons"),            //change color buttons
    frontGray = $("#frontGray"),        //front cooper gray
    frontBlue = $("#frontBlue"),        //front cooper blue color
    frontYellow = $("#frontYellow"),    //front cooper yellow color
    frontRed = $("#frontRed"),          //front cooper red color
    ExpLog = $(".ExpLog"),              //explore and small logo class for last frame
    explore = $("#explore"),            //explore bottom left
    cooperColors = $(".cooperColors"),  //pictures of the cooper colors
    chevron= $("#chevron"),             //chevron in the explore now
    active = $(".active"),              //blue button active at the last frame
    backLight = $("#backLight"),
    frontLight = $("#frontLight");

var tl = new TimelineMax({delay:0.5,});

//banner animation tomeline code

tl.from(bannerArea, .5, {autoAlpha:0}, "ExpLog")
  .from(ExpLog, .3, {autoAlpha:0}, "ExpLog")
  .from(chevron, 0, {autoAlpha:0}, "ExpLog+=.3")
  .from(cooper, 1, {x:-300, ease:Power1.easeOut}, "backLight")
  .from(backLight, 1, {x:-300, ease:Power1.easeOut}, "backLight")
  .from(theNew, 1.5, {y:-20, autoAlpha:0}, "-=1")
  .to(theNew, .3, {autoAlpha: 0, x:40})
  .to(bannerArea, .3, {backgroundColor: "#df8700"})
  .fromTo(smallCar, 2, {x:60, ease:Power1.easeOut, autoAlpha:0}, {y:60, autoAlpha:1, scale:.75})
  .to(cooper, 3,{rotationY:360, scale:.6, transformOrigin:"center 60% -300"},"backLstop-=2.60")
  .to(backLight, 0, {autoAlpha:0}, "backLstop-=2.60")
  .to(bannerArea, .4, {backgroundColor: "#950f16", ease:Power1.easeOut})
  .to(smallCar, .2, {x:0, y:0, ease:Power1.easeOut, scale:1}, "smallCar")
  .fromTo(bigPleasure, 2, {autoAlpha:0}, {autoAlpha:1}, "smallCar-=.1")
  .to(cooper, .7,{ease:Back.easeOut.config(2.5), scale:1}, "smallCar")
  .from(frontLight, .3, {autoAlpha:0, ease:Power1.easeOut, repeat: 1}, "smallCar+=.70")
  .to(frontLight, .05, {autoAlpha:0}, "-=.15")
  .to([bigPleasure,cooper,smallCar,ExpLog], .3, {autoAlpha:0})
  .to(bannerArea, .4,{backgroundColor: "#000000", boxShadow:"inset 0 0 0 7px #00a1d6"}, "-=.3")
  .from(bigLogo, 1.2, {scale:2, autoAlpha:0}, "-=.1")
  .to(bigLogo, .3, {scale:7,autoAlpha:0, ease: Power2.easeIn}, "+=.35")
  .from(frontGray, .5, { autoAlpha:0}, "buttons")
  .staggerFrom(buttons,  1, {y:-13, autoAlpha:0}, -.7, "buttons-=.01")
  .fromTo(frontRed, .7, {autoAlpha: 0}, {autoAlpha: 1}, "buttons-=.01")
  .fromTo(frontYellow, .6, {autoAlpha: 0}, {autoAlpha: 1}, "buttons+=.8")
  .fromTo(frontBlue, .6, {autoAlpha: 0},{autoAlpha: 1}, "buttons+=1.4")
  .from(change, .5, {y:-20, autoAlpha:0},"buttons+=1.7")
  .to(ExpLog, .5, {autoAlpha:1}, "buttons+=1.1")
  .fromTo(active, 0, {autoAlpha:0}, {autoAlpha:1}, "buttons+=1.7");


//functions for changing the car colors
  $(blue).click(function() {
    var b = new TimelineMax();
      b.to(cooperColors, .2, {autoAlpha: 0}, "click")
        .fromTo(frontBlue, .2, {autoAlpha: 0}, {autoAlpha: 1}, "click");
        $(buttons).removeClass('active');
      $(this).toggleClass('active');
  });
  $(yellow).click(function() {
    var b = new TimelineMax();
      b.to(cooperColors, .2, {autoAlpha: 0}, "click")
        .fromTo(frontYellow, .2, {autoAlpha: 0}, {autoAlpha: 1}, "click");
        $(buttons).removeClass('active');
        $(this).toggleClass('active');
  });
  $(red).click(function() {
    var b = new TimelineMax();
      b.to(cooperColors, .2, {autoAlpha: 0}, "click")
        .fromTo(frontRed, .2, {autoAlpha: 0}, {autoAlpha: 1}, "click");
        $(buttons).removeClass('active');
        $(this).toggleClass('active');
  });

//explore hover animation with the chevron
  explore.on("mouseenter", function(){
    TweenMax.fromTo(chevron, 1, {x:-10}, {x:0, repeat:2});
  });


              
            
!
999px

Console