Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div id="mycarousel" class="carousel slide" data-ride="carousel">
  
  <!-- carousel indicators -->
  <ol class="carousel-indicators">
    <li data-target="#mycarousel" data-slide-to="0" class="active"></li>
    <li data-target="#mycarousel" data-slide-to="1"></li>
  </ol>

  <!-- wrapper for slides -->
  <div class="carousel-inner" role="listbox">

    <!-- first slide -->
    <div class="carousel-item first active" id="1">
      <div class="carousel-caption">
        <div class="container">
          <div class="row">
            <div class="col col-xs-6">
              <h2 class="title">Special Offers</h2>
              <p class="desc">Aliquam ac lectus vitae elit maximus rutrum. Ut vulputate elementum eleifend. </p>
              <ul class="list">
                <li>Quisque vel metus</li>
                <li>Aliquam vestibulum placerat ultrices</li>
                <li>Cras pretium et est at congue</li>
                <li>Sed euismod mollis fermentum</li>
                <li>Cras pretium et est at congue</li>
              </ul>
            </div>
            <div class="col col-xs-6">
              <div class="pc-wrapper">
                <img class="pc" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/pc.png" alt="pc" width="250" height="250">
                <div class="price">From $300</div>
              </div>
              <img class="keyboard" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/keyboard.png" alt="keyboard" width="96" height="96">
              <button type="button" class="btn btn-danger btn-lg">Start Shopping</button>
            </div>
          </div>
        </div>
      </div><!-- /carousel-caption -->
    </div><!-- /item -->

    <!-- second slide -->
    <div class="carousel-item second" id="2">
      <div class="carousel-caption">
        <div class="container">
          <h2 class="title">
            <span>Which is the most popular CMS: WordPress, Drupal, or Joomla?</span>
          </h2>
          <div class="row">
            <div class="col-xs-4 cms-wrapper">
              <div class="cms">
                <div class="front">1</div>
                <div class="back">
                  <img class="img-responsive" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/wordpress_logo.svg" alt="WordPress logo" />
                </div>
              </div>
              <p class="info">WordPress</p>
            </div>
            <div class="col-xs-4 cms-wrapper">
              <div class="cms">
                <div class="front">2</div>
                <div class="back">
                  <img class="img-responsive" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/joomla_vector.svg" alt="Joomla logo" />
                </div>
              </div>
              <p class="info">Joomla</p>
            </div>
            <div class="col-xs-4 cms-wrapper">
              <div class="cms">
                <div class="front">3</div>
                <div class="back">
                  <img class="img-responsive" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/162656/drupal_vector.svg" alt="Drupal logo" />
                </div>
              </div>
              <p class="info">Drupal</p>
            </div>
          </div>
          <div class="source">
            Source: <a href="https://trends.builtwith.com/cms" target="_blank">https://trends.builtwith.com/cms</a>
          </div>
        </div>
      </div><!-- /carousel-caption-->
    </div><!-- /item -->

  </div><!--/carousel-inner -->
</div>

<!-- JS disabled -->
<p class="msg">It seems you have JavaScript disabled. The carousel doesn't work well without JavaScript. Please enable it! </p>
              
            
!

CSS

              
                
/*GENERAL STYLES*/
html {font-size: 62.5%;}
body {font-size: 1.8rem; font-family: "Noto Sans", sans-serif; color: #272626;}
.carousel-item {height: 100vh;}
.first {background: #D98F4F;}
.second {background: #2c9cae;}
.carousel-caption {top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; padding: 0; opacity: 0;}
.col {text-align: left;}
.col:last-child {text-align: center;}
.title {font-size: 3rem; margin-top: 0;}
.carousel-indicators {margin-bottom: 0;}

/*FIRST SLIDE*/
.first .title, .first .desc {padding: 15px; background: #d37c32;}
.first .title {display: inline-block;}
.first .desc {font-size: 2rem;}
.first .list {list-style: none; padding: 0; margin: 30px 0;}
.first .list li {margin-bottom: 15px; }
.first .list li::before {content: '✔'; padding-right: 10px;}
.first img {display: block; margin: 0 auto;}
.first .pc-wrapper {position: relative; width: 250px; margin: 0 auto;}
.first .price {position: absolute; top: 90px; left: 40px; padding: 5px; background: #d9534f; transform: rotate(-45deg);}
.first button {margin-top: 40px; font-size: 1.8rem;}

/*SECOND SLIDE*/
.second .title {display: block; background: transparent;}
.second span {display: inline-block; padding: 15px; background: #33b6cb;}
.second .cms {position: relative; display: flex; align-items: center; justify-content: center; width: 150px; height: 150px; padding: 5px; margin: 50px auto 10px; background: #33b6cb; border-radius: 5px; }
.second .front {font-size: 8rem; backface-visibility: hidden;}
.second .info {width: 150px; font-size: 2.2rem; text-align: center; margin: 0 auto; opacity: 0; transform: translateY(40px)}
.second .back {display: none; transform: scale(0); backface-visibility: hidden;}
.second .back img {width: 110px;}
.second .source {font-style: italic; margin-top: 40px; opacity: 0; visibility: hidden;}
.second .source a {color: #fff;}

/*MSG*/
.msg {display: none; position: fixed; top: 5px; left: 50%; transform: translateX(-50%); padding: 7px; border: 5px solid #fff000; text-align: center; color: #fff; background: rgba(0, 0, 0, .85);}

/*JS DISABLED*/
.no-js .carousel-inner > .carousel-item {display: block;}
.no-js .carousel-caption, .no-js .second .info, .no-js .second .source {opacity: 1;}
.no-js .second .info {transform: none;}
.no-js .second .source {visibility: visible;}
.no-js .carousel-indicators {display: none;}
.no-js .msg {display: block;}

/*SOME BASIC STYLES FOR SMALL SCREENS*/
@media screen and (max-width: 767px) {
  body {font-size: 1.6rem;}
  .container {width: 100%;}
  .first p {display: none;}
  .first .pc-wrapper {width: 150px;}
  .first .price {top: 45px; left: 10px;}
  .first .pc {width: 150px; height: 150px;}
  .first .keyboard {width: 50px; height: 50px;}
  .second .cms {width: 100px; height: 100px;}
  .second .info {width: 100px;}
}

              
            
!

JS

              
                (function($) {

  "use strict";
  /* jshint validthis: true */
  
  /*VARIABLES*/
  var $carousel = $("#mycarousel"),
      $carouselCaption = $(".carousel-caption"),
      counter = 0,
      firstTl,
      secondTl;

  /*INITIALIZE CAROUSEL*/
  $carousel.carousel({
    interval: false
  });

  /*FIRST TIMELINE*/
  function firstTimeline() {
    var tl = new TimelineLite(); 
    tl
      .to(".first .carousel-caption", 0.1, {opacity: 1})
      .from(".first .pc", 1, { y: -300, opacity: 0, ease: Bounce.easeOut})
      .from(".first .keyboard", 1, { y: 300, opacity: 0, ease: Bounce.easeOut}, "-=1")
      .staggerFrom(".first .list li", 0.75, {opacity: 0, cycle: {x: [-200, 200]}, ease: Power2.easeOut}, 0.15, "-=0.5" )
      .from(".first .desc", 0.7, {x: 500, opacity: 0, ease: Power4.easeOut}, "-=0.5" )
      .from(".first .title", 0.7, {x: -500, opacity: 0, ease: Power2.easeOut}, "-=0.7" )
      .from(".first .price", 0.7, {scale: 0.01, ease: Power4.easeOut})
      .from(".first button", 0.7, { y: -700, autoAlpha: 0, ease: Bounce.easeOut}, "-=0.3");
    return tl;
  }

  /*SECOND TIMELINE*/
  function secondTimeline() {
    var tl = new TimelineLite({onComplete: allDone}); 
    tl
      .from(".second .title", 0.5, { y: -400, opacity: 0, ease: Sine.easeInOut})
      .staggerFrom(".second .cms-wrapper", 0.5, {scale: 0, rotation: 180, ease: Power2.easeInOut, onComplete: completeFunc}, 1.2);
    return tl;
  }

  /*THIS FUNCTION IS CALLED WHEN THE ANIMATION FOR EACH OF THE ".second .cms-wrapper" ELEMENTS FINISHES*/
  function completeFunc() {
    var $this = $(this.target),
        $info = $this.find(".info"),
        $front = $this.find(".front"),
        $back = $this.find(".back");

    TweenLite.to($front, 0.3, {display: "none", scale: 0});
    TweenLite.to($back, 0.3, {display: "block", scale: 1, delay: 0.3});
    TweenLite.to($info, 0.3, {opacity: 1, y: 0, delay: 0.3});
  }

  /*THIS FUNCTION IS CALLED WHEN THE SECOND TIMELINE'S ANIMATION FINISHES*/
  function allDone() {
    TweenLite.to(".second .source", 0.3, {autoAlpha: 1, delay: 1});  
  }

  /*RUN FIRST TIMELINE ON PAGE LOAD*/
  $(window).on("load", function() {
    firstTl = firstTimeline();
  });

  /*RUN TIMELINE WHEN EACH OF THE SLIDES IS LOADED*/
  $carousel.on("slid.bs.carousel", function (e) {
    TweenLite.to($carouselCaption, 0.1, {opacity: 1});
    var slideId = e.relatedTarget.id;
    if(slideId === "1") {
      firstTl.restart();
      secondTl.pause();
    } else if(slideId === "2") {
      if(counter === 0) {
        secondTl = secondTimeline();
      } else {
        TweenLite.set([".second .front", ".second .back", ".second .info", ".second .source"], {clearProps:"all"});
        secondTl.restart();
      }
      counter++;
    }
  });

  /*RUN TWEEN AS YOU LEAVE EACH OF THE SLIDES*/
  $carousel.on("slide.bs.carousel", function() {
    TweenLite.to($carouselCaption, 0.1, {opacity: 0});
  });

  /*KEYBOARD NAVIGATION*/
  $(document).keyup(function(e) {
    if(e.which === 39) {
      $carousel.carousel("next");
    } else if(e.which === 37) {
      $carousel.carousel("prev");
    } 
  });

})(jQuery);
              
            
!
999px

Console