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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                header.hero
  .marquee
    .marquee__intro 
      h1.marquee__title Example
      ul.marquee__list
        li.marquee__list-item tagline one
        li.marquee__list-item tagline two
        li.marquee__list-item tagline three
      .marquee__line
  
    .marquee__box
      .marquee__tagline--logo
      p.marquee__tagline Live
      p.marquee__tagline Video
      p.marquee__tagline Player

  .slider__box
    #slider
    button#playPause play

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Raleway:400,800,900');


// Settings
$gridGap: 2rem;

// Colors
$bunker: #242629;
$white: #FFFFFF;
$mauve: #B8A9FA;

// BOX-SIZING - FONT-SIZING PRESETS
html {
  box-sizing: border-box;
  font-size: 62.5%; // Scales 1 rem unit to 10px
}

body {
  background-color: $bunker;
  display: flex;
  color: $white;
  font-size: 1.6rem; // = 14px default font size
  font-family: 'Raleway', sans-serif;
  font-weight:  700;
  margin: 0;
  min-height: 100vh;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 10%;  
}

.marquee {
  display: flex;
  width: 100%;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.marquee__intro {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.marquee__title {
  font-size: 48px;
  letter-spacing: 2px;
  margin: 0;
}

.marquee__list {
  list-style: none;
  padding: 0;
  position: relative;
  height: 56px;
  width: calc(100% - (#{$gridGap} + 13px));
  overflow: hidden;
  margin: 0;
}

.marquee__list-item {
  color: $mauve;
  line-height: 0.8;
  letter-spacing: 1px;
  position: absolute;
  top: 0;
  bottom: 0;
  margin: auto 0;
  font-size: 56px;
  font-weight: 800;
}

.marquee__text {
  margin: auto 0 0;
}

.marquee__line {
  height: 4px;
  width: 100%;
  margin-top: $gridGap/4;
  background-color: $white;
  align-self: flex-start;
}

.marquee__box {
  align-self: flex-end;
  margin-left: $gridGap/2;
  margin-bottom: -4px; // offset from line
  position: relative;
}

.marquee__tagline {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.2;
  
  &:first-of-type {
    color: $mauve;
  }
}

.marquee__tagline--logo {
  position: absolute;
  top: 2px;
  display: block;
  height: 13px;
  width: 13px;
  border-radius: 50%;
  background-color: $mauve;
  transform: translateX(calc(-100% - #{$gridGap/2}));
  color: $mauve;
  display: flex;
  align-items: center;
}

// Slider Styles

.slider__box {
  margin-top: $gridGap*4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#slider {
  background-image: none;
  border: 1px solid #555;
  background-color: #222;
  position: relative;
  max-width: 400px;
  width: 100%;
  margin-right: $gridGap*2;
}

.ui-slider .ui-slider-handle { 
  width: 20px; 
  margin-left: -10px;
  margin-top: 2px;
  height:20px; 
}

button {
  letter-spacing: 2px;
  width:100px;
  padding:10px;
  cursor: pointer;
  text-transform: uppercase;
  background-color: $mauve;
  color: $white;
  border: 0;
  border-radius: 5px;
  transition: 300ms ease;
  
  &:hover {
    transform: translateY(-2px);
    background-color: darken($mauve, 10%);
    box-shadow: 0 2px 5px 0 #000;
  }
}
              
            
!

JS

              
                var $marqueeTitle = $('.marquee__title');
var $marqueeLine = $('.marquee__line');
var $marqueeListItem = $('.marquee__list-item');
var $marqueeListItemFirst = $('.marquee__list-item:first-of-type');
var $marqueeTagline = $('.marquee__tagline');
var $marqueeTaglineLogo = $('.marquee__tagline--logo');
var tl;


function buildMarquee() {  
  
  tl = new TimelineMax({delay: 0.5, onUpdate: updateSlider});
  
  var loopFadeTween = new TimelineMax({repeat: 3});
  loopFadeTween
    .from($marqueeTaglineLogo, 0.1, {autoAlpha: 0}, '+=0.3')
    .to($marqueeTaglineLogo, 0.1, {autoAlpha: 0}, '+=0.3');
  
  var listTween = new TimelineMax({repeat: 3});
  listTween
    .add('start')
    .staggerFrom($marqueeListItem, 0.5, {autoAlpha: 0}, 5, 'start')
    .staggerTo($marqueeListItem, 0.5, {autoAlpha: 0}, 5, 'start -=5.5');
  
  
  tl
    .from($marqueeLine, 0.6, {width: 0}, 0)
    .fromTo($marqueeTitle, 0.6, {y: '+=100', autoAlpha: 0}, {y: '100%', autoAlpha: 1}, 0.1)
    .add('endLine')
    .add(loopFadeTween, 'endLine -=0.5')
    .to($marqueeTaglineLogo, 0.1, {autoAlpha: 1}, '+=0.3')
    .staggerFrom($marqueeTagline, 0.5, {autoAlpha: 0}, 0.15, '-=0.5')
    .add('startList')
    .from($marqueeListItemFirst, 0.4, {rotationX: '65deg', transformOrigin:'100% 100%'}, 'startList')
    .fromTo($marqueeListItemFirst, 0.3, {autoAlpha: 0}, {autoAlpha: 1}, 'startList')
    .to($marqueeTitle, 0.3, {y: '0%'}, 'startList')
    // .to($marqueeListItem, 0.3, {autoAlpha: 0}, 5)
    .add('startListTween')
    .add(listTween, 'startListTween');
}

// --- Slider Controls --- //
$("#slider").slider({
  range: false,
  min: 0,
  max: 1,
  step:0.001,
  slide: function ( event, ui ) {
    tl.pause();
    //adjust the timeline's progress() based on slider value
    tl.progress( ui.value);
    }
});

function updateSlider() {
  $("#slider").slider("value", tl.progress());
} 

$("#slider, .ui-slider-handle").mousedown(function() {
  $('html, #slider, .ui-slider-handle').one("mouseup", function(e){
    tl.resume();
  });
});

//smoothe play pause by tweening the timeScale()

$("#playPause").click(function(){
  if(this.innerHTML == "play"){
    this.innerHTML = "pause"
    TweenLite.to(tl, 0.3, {timeScale:1})
  } else {
    this.innerHTML = "play"
    TweenLite.to(tl, 0.3, {timeScale:0})
  }
})

// $(window).on('resize', function() { 
//   tl.progress(0).invalidate();
// });

buildMarquee();
tl.progress(0).timeScale(0); // Change to 0 when not building

TweenLite.render(); //lazy rendering (a performance optimization) can cause the initial render to be delayed by 1 tick, causing the logo to be visible for a brief moment, so we force a render here immediately. Another option would be to set lazy:false on the tween(s), but this is easier/faster.
              
            
!
999px

Console