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></header>

<div class="Slate-device">

<div class="Slate-itemsWrapper">

      <section class="Slate-item" data-title="Title 1" data-producer="Producer One" data-country="England">
		  
		  <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=1"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
          </div>
        
      </section>

      <section class="Slate-item" data-title="Title 2" data-producer="Producer Two" data-country="Hungry">
  
          <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=2"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>
  
      </section>

      <section class="Slate-item" data-title="Title 3" data-producer="Producer Three" data-country="Bulgaria">
  
          <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=3"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>
  
      </section>

      <section class="Slate-item" data-title="Title 4" data-producer="Producer Four" data-country="Brazil">
  
          <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=4"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>
  
      </section>
  
      <section class="Slate-item" data-title="Title 5" data-producer="Producer Five" data-country="Finland">
  
          <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=5"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>
  
      </section>

      <section class="Slate-item" data-title="Title 6" data-producer="Producer Six" data-country="Portugal">
  
          <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=6"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>
  
      </section>

      <section class="Slate-item" data-title="Title 7" data-producer="Producer Seven" data-country="France">
  
        <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=7"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>

      </section>

      <section class="Slate-item" data-title="Title 8" data-producer="Producer Eight" data-country="Argentina">
  
          <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=8"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>
  
      </section>
  
      <section class="Slate-item" data-title="Title 9" data-producer="Producer Nine" data-country="Spain">
  
          <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=9"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>
  
      </section>

      <section class="Slate-item" data-title="Title 10" data-producer="Producer Ten" data-country="Netherlands">
  
       <div class="Slate-itemInner">
              <div class="Slate-mediaWrapper">
                  <div class="Slate-imageWrapper">
                      <img alt="image alt text" src="https://picsum.photos/600/800?random=10"/>
                  </div>
                  <video playsinline muted loop autoplay disablePictureInPicture disableRemotePlayback>
                    <source src="//sy2729.github.io/portofolio/video/intro1.mp4" type="video/mp4" />
                    <p class="vjs-no-js">
                      To view this video please enable JavaScript, and consider upgrading to a
                      web browser that
                      <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
                    </p>
                  </video>
              </div>
          </div>

    </section>
  
  </div>
	
</div>
	
<footer></footer>
              
            
!

CSS

              
                ::-webkit-scrollbar {
  display: none;
}

/* NEW WAY */

html, body {
	width:100%;
	height:100%;
	overflow:hidden;
	margin:0;
  	display: flex;
  flex-direction : column;
} 

header,footer {height:100px;background-color:#111;}

.Slate-device {
	 display: flex;
  flex-direction: column;
  align-items: center;
	flex-grow:1;
	width:100%;
	background-color: #111;
}

.Slate-itemsWrapper {
	width:100%;
	display:flex;
	align-items:center;
	justify-content:center;
	flex-direation:rows;
}

.Slate-item {
	width:7%;
	height:50vh;
	border-radius:15px;
	overflow:hidden;
	margin-top:20px;
	margin-left:20px;
   position: relative;
	border:3px solid #fff;
	-webkit-box-reflect: below 10px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(70%, transparent) , to(rgba(250, 250, 250, 0.1)));
}
.Slate-item .Slate-itemInner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: pointer;
    background: #000;
}
/* .Slate-item:first-child {
    padding-left: 0;
}
.Slate-item:last-child {
    padding-right: 0;
} */
.Slate-item .Slate-mediaWrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(1vh *30);
    height: calc(100% + 2px);
    z-index: 0;
}
.Slate-item .Slate-imageWrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e7e5df;
}
.Slate-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: auto;
    height: 100%;
    pointer-events: none;
	filter: grayscale(100%);
}
.Slate-item video {
    position: absolute;
    z-index: 1;
    width: 100%;
    height: 100%;
    opacity: 0;
    -o-object-fit: cover;
    object-fit: cover;
    pointer-events: none;
	filter: grayscale(100%);
}
              
            
!

JS

              
                let expanders = gsap.utils.toArray(".Slate-item");
let active; // keep track of which expander is open
let expanderWidth;

expanders.forEach(function(expander, index){

	expanderWidth = expander.offsetWidth;
	
	const expanderVideo = expander.querySelector("video");
	
	//create animation for each expander
	let animation = gsap.timeline({paused:true})
	animation.to (expander, {
		width:expanderWidth*2, 
		duration:0.4
	});
	animation.to (expanderVideo, {
		autoAlpha:1,
		duration:0.5
	},"<");
	//apply the timeline animation to an animation property on the expander
	expander.animation = animation
	
	expander.addEventListener("mouseenter", function() {
		if(active) {
			//close the active expander if there is one by reversing it
			active.animation.reverse()
		}
		expander.animation.play();
		active = expander;
		
	})
	
	expander.addEventListener("mouseleave", function(event) {
		//event.stopPropagation()
		expander.animation.reverse();
	})
})

              
            
!
999px

Console