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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <div id="cs-carousel" class="carousel slide carousel-fade work-section-content hide-visibility" data-ride="carousel" data-interval="false">
    <div class="hidden-xs hidden-tablet ">
        <div id="frame" class="frame-tablet">
            <div class="bpr-frame fade-last">
                <div class="cs-info-wrap">
                    <button class="btn btn-play-video play-video">play video</button>
                    <img src="https://www.croscon.com/img/logo.svg" class="cs-logo" alt="" width="160" height="24">
                    <p>Explore the Blueprint Registry Case Study</p>
                </div>

                <video id="video" class="work-video bpr-mobile-video fade-last" muted="" autobuffer="">
                    <source src="https://www.croscon.com/video/bpr-mobile.webm" type="video/webm; codecs=&quot;vp8, vorbis&quot;">
                    <source src="https://www.croscon.com/video/bpr-mobile.mp4" type="video/mp4">
                    Your browser does not support the video tag
                </video>

                <video id="video" class="work-video bpr-tablet-video fade-last active" muted="" autobuffer="">
                    &gt;
                    <source src="https://www.croscon.com/video/bpr-tablet.webm" type="video/webm; codecs=&quot;vp8, vorbis&quot;">
                    <source src="https://www.croscon.com/video/bpr-tablet.mp4" type="video/mp4">
                    Your browser does not support the video tag
                </video>

                <video id="video" class="work-video bpr-display-video fade-last" muted="">
                    <source src="https://www.croscon.com/video/bpr-display.webm" type="video/webm; codecs=&quot;vp8, vorbis&quot;">
                    <source src="https://www.croscon.com/video/bpr-display.mp4" type="video/mp4">
                    Your browser does not support the video tag
                </video>
            </div>
        </div>
    </div>

    <div class="carousel-inner">
        <div class="item">
            <div class="device-wrap device-mobile-wrap">
                <svg class="device-mobile" width="231" height="479" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 429 884.5" enable-background="new 0 0 429 884.5" xml:space="preserve">
                                <path class="fade-last" fill="black" d="M350.4,881.5H78.6c-40.1,0-72.9-32.8-72.9-72.9
                                    V75.9C5.8,35.8,38.5,3,78.6,3h271.8c40.1,0,72.9,32.8,72.9,72.9v732.8C423.3,848.8,390.5,881.5,350.4,881.5z"></path>
                                <circle class="fade-last" fill="#5b5b5b" cx="213.7" cy="33.7" r="5.9"></circle>
                                <circle class="fade-last" fill="#5b5b5b" cx="158.8" cy="61.3" r="2.5"></circle>
                                <path class="fade-last" fill="#5b5b5b" d="M185.5,57.5h56.2c2,0,3.7,1.6,3.7,3.7v0c0,2-1.6,3.7-3.7,3.7h-56.2c-2,0-3.7-1.6-3.7-3.7v0
                                    C181.9,59.1,183.5,57.5,185.5,57.5z"></path>
                                <polygon class="animated-line" fill="none" stroke="#5b5b5b" stroke-width="4" stroke-miterlimit="10" points="27.7,109.6 401.2,109.6
		                            401.2,773.8 28.2,773.8 	"></polygon>
                                <path class="animated-line" fill="none" stroke="#5b5b5b" stroke-width="6" stroke-miterlimit="10" d="M350.4,881.5H78.6c-40.1,0-72.9-32.8-72.9-72.9
                                    V75.9C5.8,35.8,38.5,3,78.6,3h271.8c40.1,0,72.9,32.8,72.9,72.9v732.8C423.3,848.8,390.5,881.5,350.4,881.5z"></path>
                                <circle class="delay-animated-line" fill="none" stroke="#5b5b5b" stroke-width="4" stroke-miterlimit="10" cx="214.5" cy="823.8" r="32.5"></circle>
                                <path class="fade-last" fill="#5b5b5b" d="M1.8,114L1.8,114c1,0,1.8,0.8,1.8,1.8v27.7c0,1-0.8,1.8-1.8,1.8h0c-1,0-1.8-0.8-1.8-1.8v-27.7
                                    C0,114.8,0.8,114,1.8,114z"></path>
                                <path class="fade-last" fill="#5b5b5b" d="M1.8,205.8L1.8,205.8c1,0,1.8,0.8,1.8,1.8v50.9c0,1-0.8,1.8-1.8,1.8h0c-1,0-1.8-0.8-1.8-1.8l0-50.9
                                    C0,206.6,0.8,205.8,1.8,205.8z"></path>
                                <path class="fade-last" fill="#5b5b5b" d="M1.8,281.3L1.8,281.3c1,0,1.8,0.8,1.8,1.8V334c0,1-0.8,1.8-1.8,1.8h0c-1,0-1.8-0.8-1.8-1.8l0-50.9
                                    C0,282.1,0.8,281.3,1.8,281.3z"></path>
                                <path class="fade-last" fill="#5b5b5b" d="M426.8,201L426.8,201c1,0,1.8,0.8,1.8,1.8v60.8c0,1-0.8,1.8-1.8,1.8l0,0c-1,0-1.8-0.8-1.8-1.8v-60.8
		                            C425,201.8,425.8,201,426.8,201z"></path>
                                <image class="visible-xs visible-tablet" overflow="visible" width="375" height="670" xlink:href="https://www.croscon.com/img/mobile-mobile-img.jpg" transform="matrix(0.9847 0 0 0.9847 29.6149 112.0218)">
                                </image>
                            </svg>
            </div>
        </div>
        <div class="item active">
            <div class="device-wrap device-tablet-wrap">
                <svg class="device-tablet" width="535" height="378" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 834.9 589.2" enable-background="new 0 0 834.9 589.2" xml:space="preserve">
                                <path class="fade-last" fill="black" d="M38.1,3h758.7c19.3,0,35.1,15.8,35.1,35.1v513
                                    c0,19.3-15.8,35.1-35.1,35.1H38.1C18.8,586.2,3,570.4,3,551.1v-513C3,18.8,18.8,3,38.1,3z"></path>
                                <path class="animated-line" fill="none" stroke="#5b5b5b" stroke-width="6" stroke-miterlimit="10" d="M38.1,3h758.7c19.3,0,35.1,15.8,35.1,35.1v513
                                    c0,19.3-15.8,35.1-35.1,35.1H38.1C18.8,586.2,3,570.4,3,551.1v-513C3,18.8,18.8,3,38.1,3z"></path>
                                <polyline class="animated-line" fill="none" stroke="#5b5b5b" stroke-width="4" stroke-miterlimit="10" points="77.9,549.1 77.9,40 757.1,40
	                                757.1,549.1 77.9,549.1 "></polyline>
                                <circle class="delay-animated-line" fill="none" stroke="#5b5b5b" stroke-width="3" stroke-miterlimit="10" cx="36.2" cy="295.2" r="18.2"></circle>
                                <circle class="fade-last" fill="#5b5b5b" cx="795.9" cy="294.7" r="4.6"></circle>
                                <image class="visible-xs visible-tablet" overflow="visible" width="1024" height="768" xlink:href="https://www.croscon.com/img/mobile-tablet-img.jpg" transform="matrix(0.6594 0 0 0.6594 79.8522 41.0141)">
                                </image>
                            </svg>
            </div>
        </div>
        <div class="item">
            <div class="device-wrap device-display-wrap">
                <svg class="device-display" width="670" height="508" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 921.5 698.6" enable-background="new 0 0 921.5 698.6" xml:space="preserve">
                                <polygon class="fade-last" points="368.3,559.7 550.1,560.5 558.1,651.5 596.1,687.9 597.4,693 588.6,696.6 336.6,696.6 325.1,694.4
                                    322.6,689.5 327.6,685 338.1,676.5 344.1,671.5 348.1,668.5 354.1,662 360.1,653 363.1,639.5 "></polygon>
                                <path class="animated-line" fill="none" stroke="#5B5B5B" stroke-width="6" stroke-miterlimit="10" d="M25.4,3h870.6c12.3,0,22.4,10.1,22.4,22.4v510.1
                                    c0,12.3-10.1,22.4-22.4,22.4H25.4C13.1,558,3,547.9,3,535.6V25.4C3,13.1,13.1,3,25.4,3z"></path>
                                <path class="fade-last" fill="black" d="M25.4,3h870.6c12.3,0,22.4,10.1,22.4,22.4v510.1
                                    c0,12.3-10.1,22.4-22.4,22.4H25.4C13.1,558,3,547.9,3,535.6V25.4C3,13.1,13.1,3,25.4,3z"></path>
                                <polyline class="animated-line" fill="none" stroke="#5B5B5B" stroke-width="4" stroke-miterlimit="10" points="40.1,512 40.1,39.9 882.2,39.9
	                                882.2,512 40.1,512 "></polyline>
                                <path class="animated-line" fill="none" stroke="#5B5B5B" stroke-width="4" stroke-miterlimit="10" d="M368.3,560.5l-5.6,75.6c0,0-0.6,8.1-2.5,14.8
                                    c-2,6.7-16.7,19.5-16.7,19.5l-19.2,15.9c0,0-3.9,2.5-2.5,6.1c1.4,3.6,20.9,3.6,20.9,3.6H586"></path>
                                <path class="animated-line" fill="none" stroke="#5B5B5B" stroke-width="4" stroke-miterlimit="10" d="M551.5,561l5.2,75.6c0,0,0.5,8.1,2.4,14.8
                                    s16.6,19.6,16.6,19.6l19.2,16c0,0,3.9,2.5,2.5,6.1c-1.4,3.6-20.9,3.5-20.9,3.5l-243-0.9"></path>
                                <image class="visible-xs visible-tablet" overflow="visible" width="837" height="471" xlink:href="https://www.croscon.com/img/mobile-display-img.jpg" transform="matrix(0.9998 0 0 0.9998 42.2602 40.4009)">
                                </image>
                            </svg>
            </div>
        </div>
    </div>

    <div class="device-indicators-wrap">
        <ol class="carousel-indicators device-indicators">
            <li data-target="#cs-carousel" data-slide-to="0" class="mobile-indicator">
                <i class="ss-icon ss-cell"></i>
            </li>
            <li data-target="#cs-carousel" data-slide-to="1" class="active">
                <i class="ss-icon ss-tablet"></i>
            </li>
            <li data-target="#cs-carousel" data-slide-to="2">
                <i class="ss-icon ss-desktop"></i>
            </li>
        </ol>
    </div>
</div>
<button class="btn toggle-animation">Start Animation</button>
              
            
!

CSS

              
                // --------------------------------------------------
// BPR Caststudy - SVG Animations
// --------------------------------------------------

/*
   Table of Contents
   --------------------------------------------------
   :: 1.0 - Animation Definitions
   :: 1.1 - Containers
   :: 1.2 - Components
   :: 1.3 - Carousel
   :: 1.4 - Devices
   :: 1.5 - Devices Frames
   :: 1.6 - Device Videos
   :: 1.7 - Section Responsiveness
*/

@svgStroke: #5B5B5B;
@yellow: #ffcc00;

// -------------------------------------------------------
// 1.0 - Animation definitions
// -------------------------------------------------------

// Dash Animation
@-webkit-keyframes dash {
  to {
    stroke-dashoffset: 1000;
  }
}
@-moz-keyframes dash {
  to {
    stroke-dashoffset: 1000;
  }
}
@keyframes dash {
  to {
    stroke-dashoffset: 1000;
  }
}
@-ms-keyframes dash {
  to {
    stroke-dashoffset: 1000;
  }
}

// Fade Animation
@-webkit-keyframes fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@-moz-keyframes fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@-ms-keyframes fade {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}


// Stagger some elements so they fad AFTER line animation is complete.
// Used for things like the black device background, and other small lines in the SVG
// that do not get the line animation.

.fade-last {
  opacity: 0;
}

.fade-last {
  -webkit-animation: fade 0.5s 0.5s cubic-bezier(.33,0,.2,1) forwards;
  animation: fade 0.5s 0.5s cubic-bezier(.33,0,.2,1) forwards;
}

// No animations for IE :(.
.no-smil .animated-line {
  stroke-dasharray: 0 !important;
}

// -------------------------------------------------------
// 1.1 - Containers
// -------------------------------------------------------

body {
  background-color: #191919;
  font-size: 20px;

  // Activate animations by setting the .active class on the body.
  // This is particularly useful because we can target multiple selectors with one 'active' class definition.
  // (better than doing this by an individual basis).

  &.active {
    .animated-line {
      -webkit-animation: dash 2s cubic-bezier(.33,0,.2,1) forwards;
      animation: dash 2s cubic-bezier(.33,0,.2,1) forwards;
    }

    .delay-animated-line {
      -webkit-animation: dash 3s cubic-bezier(.33,0,.2,1) forwards;
      -webkit-animation-delay: 1.5s;
      animation: dash 3s cubic-bezier(.33,0,.2,1) forwards;
      animation-delay: 1.5s;
    }

    .fade-last {
      -webkit-animation: fade 0.5s 1.5s cubic-bezier(.33,0,.2,1) forwards;
      animation: fade 0.5s 1.5s cubic-bezier(.33,0,.2,1) forwards;
    }

  }
}

#frame {
  background-color: black;
  position: absolute;
  left: 50%;
  z-index: 9999;
  top: 0;
  -webkit-transition: all .5s ease-in-out;
  -webkit-transform: translate3d(-50%,0,0);
  transition: all .5s ease-in-out;
  transform: translate3d(-50%,0,0);

  &.frame-mobile {
    height: 355px;
    width: 198px;
    top: 62px;
  }

  &.frame-tablet {
    width: 431px;
    height: 323px;
    top: 97px;
  }

  &.frame-display {
    width: 610px;
    height: 340px;
    top: 31px;
  }

}

.svg-wrap {
  margin-top: 50px;
}

// Background wrap and carousel container
.devices {
  padding: 3.93em 0;
  background-image: url("/img/work-bpr/bpr-carousel-bg.jpg?ts=ASSET_VERSION");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  min-height: 0;
  position: relative;
  margin: 1.67em 0;
}

// Settings for SVG
.device-wrap {
  svg {
    display: block;
  }
}

// -------------------------------------------------------
// 1.2 - Components
// -------------------------------------------------------

// Button to toggle animation
.btn {
  height: 40px;
  background-color: #fc0;
  border: 0;
  padding: 7px 20px;
  -webkit-transition: all 0.5s ease-in-out;
  transition: all 0.5s ease-in-out;
  margin: 20px auto;
  width: 200px;
  display: block;
  text-align: center;
  font-size: 0.8em;
  &:hover {
    background-color: darken(#FC0, 15%);
  }

  &:active {
    background-color: lighten(#FC0, 15%);
    -webkit-transition: all 0.25s ease-in-out;
    transition: all 0.25s ease-in-out;
    outline: 0;
  }

  &:focus {
    outline: 0;
  }

}

.btn-play-video {
  max-width: 110px; 
  padding: 0 10px;
  color: black;
}

.hide-visibility {
  visibility: hidden;
  opacity: 0;
}


// -------------------------------------------------------
// 1.2 - Carousel
// -------------------------------------------------------

/* Thanks to Roland Warmerdam for this BS fade Transition:
   https://codepen.io/Rowno/details/Afykb */
// --------------------------------------------------
.carousel-fade {
  .carousel-inner {
    .item {
      opacity: 0;
      -webkit-transition: opacity .5s ease;
      -moz-transition: opacity .5s ease;
      -o-transition: opacity .5s ease;
      transition: opacity .5s ease;
    }

    .active {
      opacity: 1;
      &.left, &.right {
        left: 0;
        opacity: 0;
        z-index: 1;
      }
    }
    .next.left,
    .prev.right {
      opacity: 1;
    }
  }
}

#cs-carousel {
  position: relative;
  margin-top: 20px;
  .carousel-inner {
    height: 508px;
  }
}

.device-indicators-wrap {
  border-top: 4px solid @yellow;
  max-width: 13em;
  margin: 1.33em auto 0;
}

.device-indicators {
  margin: 0;
  padding: 20px;
  position: static;
  width: auto;
  font-size: 0;
  white-space: nowrap;

  li {
    width: 20px;
    height: 20px;
    border: none;
    margin-left: 20px;
    display: inline-block;
    cursor: pointer;
    font-size: 2em;
    background-color: #333333;

    &:first-child {
      margin-left: 0;
    }

    &.active {
      background-color: @yellow;
      width: 20px;
      height: 20px;
      margin-left: 20px;

      &:first-child {
        margin-left: 0;
      }

      .hover-yellow {
        fill: @yellow;
      }
    }

    &:hover {
      background-color: darkgray;
    }

  }
}

// -------------------------------------------------------
// 1.3 - Device Mobile
// -------------------------------------------------------

.device-mobile-wrap {
  max-width: 231px;
  min-width: 180px;
  position: relative;
  margin: 0 auto;
}

.device-mobile {
  width: auto;
  .animated-line,
  .delay-animated-line {
    stroke-dasharray: 3500;
    stroke-dashoffset: 3500;
  }
}

// -------------------------------------------------------
// 1.3 - Device Tablet
// -------------------------------------------------------


.device-tablet-wrap {
  top: 70px;
  width: 84.765625%;
  max-width: 535px;
  position: relative;
  margin: 0 auto;
}

.device-tablet {
  .animated-line,
  .delay-animated-line {
    stroke-dasharray: 3764;
    stroke-dashoffset: 3764;
  }
}

// -------------------------------------------------------
// 1.3 - Device Display
// -------------------------------------------------------

// Display SVG
.device-display {
  .animated-line {
    stroke-dasharray: 3902;
    stroke-dashoffset: 3902;
  }
}

.device-display-wrap {
  width: 98.4375%;
  max-width: 670px;
  margin: 0 auto;
  display: block;
  position: relative;
}

// -------------------------------------------------------
// 1.4 - Devices
// -------------------------------------------------------

// BPR Frame (initial screen before video is played)
.bpr-frame {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background-color: black;
  position: absolute;
  cursor: pointer;

  &:hover {
    color: #FC0;
    .cs-info-wrap .play-video {
      color: #FC0;
      border: 3px solid #FC0;
    }
  }

  .cs-info-wrap {
    background-color: rgba(0,0,0,0.9);
    height: 100%;
    width: 100%;
    padding: 2em 0.67em;
    position: relative;
    z-index: 11;
    text-align: center;

    .cs-logo {
      margin-bottom: 20px;
      max-width: 160px;
    }

    p {
      color: white;
      font-size: .73em;
    }

  }
}

// -------------------------------------------------------
// 1.5 - Devices - Videos
// -------------------------------------------------------

.work-video {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  display: none;

  &.active {
    display: block;
  }

  &.bpr-mobile-video {
    left: -109%;
    height: 100%;
  }

  &.bpr-tablet-video {
    height: 100%;
  }

  &.bpr-display-video {
    // HACK: forcing this 1% more than 100 so that video aligns correctly to SVG
    height: 101%;
  }
}
              
            
!

JS

              
                $(function(){

 "use strict"; 
  
	var Engine = {
    utils : {
      
    	deviceIndicatorClicks : function() {

        // Cache a few selectors.
        var deviceIndicator = $('.device-indicators li')
          , frame = $('#frame')
          , csInfoWrap = $('.cs-info-wrap')
          , csCarousel = $('#cs-carousel')
        ;

        // We can use this hoook to detect IE and disable line-aniamtions. 
        if (!Modernizr.smil) {
          csCarousel.find('svg').addClass('ie');
        }
  
        // Once you click on the info wrap overlay, hide the wrap, then find and play the video.
        csInfoWrap.on('click touchstart', function() {
          $(this).fadeOut();
          $(this).parent().find('video.active').get(0).play();
          $(this).parent().find('video.active').on('ended', function() {
            csInfoWrap.fadeIn( function() {
              $(this).parent().find('video.active').get(0).load();
            });
          });
        });

        // Reset infor wrap and videos.
        csCarousel.on('slide.bs.carousel', function() {
          csInfoWrap.fadeIn();
          csInfoWrap.parent().find('video.active').get(0).pause();
          csInfoWrap.parent().find('video.active').get(0).load();
        });

        // Take over the device indicator clicks from boostrap and set some classes for showing/hiding videos.
        deviceIndicator.click(function(e) {

          var slideTo = $(this).data('slide-to');

          // Mobile
          if (slideTo === 0) {
            frame.removeClass();
            frame.addClass('frame-mobile');
            frame.find('.work-video').removeClass('active');
            frame.find('.bpr-mobile-video').addClass('active');
          }

          // Tablet
          if (slideTo === 1) {
            frame.removeClass();
            frame.addClass('frame-tablet');
            frame.find('.work-video').removeClass('active');
            frame.find('.bpr-tablet-video').addClass('active');
          }

          // Display
          if (slideTo === 2) {
            frame.removeClass();
            frame.addClass('frame-display');
            frame.find('.work-video').removeClass('active');
            frame.find('.bpr-display-video').addClass('active');
          }

        });

        //}

      },
      
      toggleAnimation: function () {
        var $toggleAnimationBtn = $('.toggle-animation')
      	 $toggleAnimationBtn.on('click', function() {
          $('#cs-carousel').removeClass('hide-visibility');
          $('body').toggleClass('active');
        });
    	}
  	}
  }
  
  Engine.utils.deviceIndicatorClicks();
	Engine.utils.toggleAnimation();
  
});
              
            
!
999px

Console