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.

Details

Privacy

Go PRO Window blinds lowered to protect code. Code Editor with window blinds (raised) and a light blub turned on.

Keep it secret; keep it safe.

Private Pens are hidden everywhere on CodePen, except to you. You can still share them and other people can see them, they just can't find them through searching or browsing.

Upgrade to PRO

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.

Template

Make Template?

Templates are Pens that can be used to start other Pens quickly from the create menu. The new Pen will copy all the code and settings from the template and make a new Pen (that is not a fork). You can view all of your templates, or learn more in the documentation.

Template URL

Any Pen can act as a template (even if you don't flip the toggle above) with a special URL you can use yourself or share with others. Here's this Pen's template URL:

Screenshot

Screenshot or Custom Thumbnail

Screenshots of Pens are shown in mobile browsers, RSS feeds, to users who chose images instead of iframes, and in social media sharing.

This Pen is using the default Screenshot, generated by CodePen. Upgrade to PRO to upload your own thumbnail that will be displayed on previews of this pen throughout the site and when sharing to social media.

Upgrade to PRO

HTML

              
                <body>
<!-- carousel on homepage -->
        <div id="carousel-example-generic" class="carousel slide carousel-fade">
          <!-- indicators -->
          <ol class="carousel-indicators">
            <li data-target="#carousel-example-generic" class="active ind1" data-slide-to="0"></li>
            <li data-target="#carousel-example-generic" class="ind2" data-slide-to="1"></li>
          </ol>
          <!-- wrapper for slides -->
          <div class="carousel-inner" role="listbox">
            <div class="item one active">
              <div class="carousel-caption">
                <h3 class="tlt">Title 1</h3> 
                <h4 class="tlt2">Caption for slide ONE</h4>       
              </div>
            </div>
            <div class="item two">
              <div class="carousel-caption">
                 <h3 class="it-h3">Title 2</h3> 
                 <h4 class="it-h4">Caption for slide TWO</h4>                    
              </div>
            </div>            

        </div>
</body>
              
            
!

CSS

              
                body {
    width: 100%;
    height: 100% !important; 
    font-family: Lora,"Helvetica Neue",Helvetica,Arial,sans-serif;
    color: #000;
    background-color: #fff;
}

html {
    width: 100%;
    height: 100% !important; 
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 35px;
    text-transform: uppercase;
    font-family: Montserrat,"Helvetica Neue",Helvetica,Arial,sans-serif;
    font-weight: 700;
    letter-spacing: 1px;
}

/* For accurate rendering of CSS animations, those elements must have a position of relative, absolute or fixed */
#download_h2, 
#download_p, 
#download_btn, 
.tlt, .tlt2, 
.fa-angle-double-down,
#it-h4,
#it-p,
.two {
    position: relative;
}
.carousel-fade, 
.carousel-fade .carousel-inner, 
.carousel-fade .carousel-inner .item, 
.carousel-fade .carousel-inner .item img { 
    min-height: 100%; 
    height: 100%; 
    margin: 0; 
    width: 100%; 
}
.carousel-fade .carousel-inner .one {
    background-color: blue;
    opacity: 0;
    transition-property: opacity;
}
.carousel-fade .carousel-inner .two {
    background-color: green;
    opacity: 0;
    transition-property: opacity;
}

.carousel-fade .carousel-inner .active {
    opacity: 1;
}
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
    left: 0;
    opacity: 0;
    z-index: 1;
}
.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
    opacity: 1;
}
.carousel-fade .carousel-control {
    z-index: 2;
}


              
            
!

JS

              
                /*------- Bootstrap Carousel -------*/

var $myCarousel = $('#carousel-example-generic');

// Creating Timelines for carousel-sliders
var timelines = [];
// Timeline elements
timelines[0] = createTimeline1('.tlt', '.tlt2', '', '', ''); 
timelines[1] = createTimeline2('.it-h3', '.it-h4', '', '', '');

function doAnimations(elems) {
    var animEndEv = 'webkitAnimationEnd animationend';
    elems.each(function () {
        var $this = $(this), $animationType = $this.data('animation');
        $this.addClass($animationType).one(animEndEv, function () {
            $this.removeClass($animationType);
        });
    });
}

var $firstAnimatingElems = $myCarousel.find('.item:first').find('[data-animation ^= "animated"]');
timelines[0].play();
doAnimations($firstAnimatingElems);
$myCarousel.carousel('pause');
$myCarousel.on('slide.bs.carousel', function (e) {
    var currentSlideIndex = $(e.relatedTarget).index();
    timelines[currentSlideIndex].restart();
    var $animatingElems = $(e.relatedTarget).find("[data-animation ^= 'animated']");
    doAnimations($animatingElems);
});

// Timeline for slider 1
function createTimeline1(element1, element2, element3, element4, element5) {
    var timeline1 = new TimelineMax({ paused: true });
    if (element1 !== '') { timeline1.from(element1, 0.9, { x: -1000, autoAlpha: 0, ease: Power4.ease, delay: 0.8 }); }
    if (element2 !== '') { timeline1.from(element2, 0.9, { x: 1000, autoAlpha: 0, ease: Power4.ease }, "-=0.9") } 
  return timeline1
}

// Timeline for slider 2
function createTimeline2(element1, element2, element3, element4, element5) {
    var timeline2 = new TimelineMax({ paused: true });
    if (element1 !== '') { timeline2.from(element1, 0.6, { x: -1000, autoAlpha: 0, delay: 0.6 }); }
    if (element2 !== '') { timeline2.from(element2, 0.6, { x: 1000, autoAlpha: 0 }, "-=0.6"); }
    return timeline2;
}


              
            
!
999px
What's a functional programmer's favorite animal? A lamb, duh!

Console