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.

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

              
                <section class="works">
	<div class="wrapper">
		<div class="slider-controls">
			<div class="slider-control" data-slide="0">1</div>
			<div class="slider-control" data-slide="1">2</div>
			<div class="slider-control" data-slide="2">3</div>
			<div class="slider-control" data-slide="3">4</div>
			<div class="slider-control" data-slide="4">5</div>
		</div>
		<div class="slider">
			<div class="slide">1</div>
			<div class="slide">2</div>
			<div class="slide">3</div>
			<div class="slide">4</div>
			<div class="slide">5</div>
		</div>
		<div class="slider-description">
			<div class="description">
				<h3 class="company-name">Lorem ipsum dolor sit amet #1</h3>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis porro voluptatum et, illum cum commodi dolorum numquam repellat nemo, aut tempore, pariatur architecto laborum, maxime recusandae iste aliquid esse assumenda.</p>
			</div>
			<div class="description">
				<h3 class="company-name">Lorem ipsum dolor sit amet #2</h3>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis porro voluptatum et, illum cum commodi dolorum numquam repellat nemo, aut tempore, pariatur architecto laborum, maxime recusandae iste aliquid esse assumenda.</p>
			</div>
			<div class="description">
				<h3 class="company-name">Lorem ipsum dolor sit amet #3</h3>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis porro voluptatum et, illum cum commodi dolorum numquam repellat nemo, aut tempore, pariatur architecto laborum, maxime recusandae iste aliquid esse assumenda.</p>
			</div>
			<div class="description">
				<h3 class="company-name">Lorem ipsum dolor sit amet #4</h3>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis porro voluptatum et, illum cum commodi dolorum numquam repellat nemo, aut tempore, pariatur architecto laborum, maxime recusandae iste aliquid esse assumenda.</p>
			</div>
			<div class="description">
				<h3 class="company-name">Lorem ipsum dolor sit amet #5</h3>
				<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis porro voluptatum et, illum cum commodi dolorum numquam repellat nemo, aut tempore, pariatur architecto laborum, maxime recusandae iste aliquid esse assumenda.</p>
			</div>
		</div>
	</div>
</section>
              
            
!

CSS

              
                section.works {
	width: 60%;
	height: 100%;
	min-height: 100vh;
	padding: 10%;
  
  opacity: 0;
  
	.wrapper {
		width: 100%;
		display: flex;
		flex-flow: row nowrap;
		position: relative;
		overflow: hidden;
		.slider-controls {
			display: inline-flex;
			position: absolute;
			top: 5%;
			right: 5%;
			z-index: 100;
		}
		.slider-controls > div {
			font-size: calc(60% + 3vmin);
			cursor: pointer;
			background-color: transparent;
      
      &.active{
        border: solid 1px red;
      }
		}
		.slider-controls div.active {
			border-bottom: 3px #d72229 solid;
		}
		.slider-controls>div:not(:last-child) {
			margin-right: 50px;
		}
		.slider {
			width: 60%;
			height: 600px;
			position: relative;
			overflow: hidden;
			.slide{
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 600px;
			}
			.slide:nth-child(1){
				background: url(http://placehold.it/1000x1000) no-repeat;
				background-size: cover;
			}
			.slide:nth-child(2){
				background: url(http://placehold.it/1000x1000) no-repeat;
				background-size: cover;
			}
			.slide:nth-child(3){
				background: url(http://placehold.it/1000x1000) no-repeat;
				background-size: cover;
			}
			.slide:nth-child(4){
				background: url(http://placehold.it/1000x1000) no-repeat;
				background-size: cover;
			}
			.slide:nth-child(5){
				background: url(http://placehold.it/1000x1000) no-repeat;
				background-size: cover;
			}
		}
		.slider-description {
			width: 50%;
			height: 600px;
			margin-left: -10%;
			position: relative;
			overflow: hidden;
			.description {
				width: 100%;
				height: 600px;
				position: absolute;
				top: 0;
				right: 0;
				transform: translate(0, 50%);
				h3.company-name {
					color: red;
					padding-bottom: 3%;
				}
				p {
					font-weight: 500;
				}
			}
		}
	}
}
              
            
!

JS

              
                console.clear();

var slideDelay = 1.5;
var slideDuration = 0.3;

var slideElements = document.querySelectorAll(".slide");
var controlElements = document.querySelectorAll(".slider-control");
var descriptionElements = document.querySelectorAll(".description");

var slides = Array.prototype.map.call(slideElements, createSlide);

slides.forEach(function(slide, i) {
  slide.next = slides[i+1] || slides[0];
  slide.duration = slideDuration;
});

var currentSlide = slides[0];
var autoPlay = TweenLite.delayedCall(slideDelay, setSlide);

TweenLite.set(".works", { autoAlpha: 1 });

console.log("SLIDES", slides);

//
// SET SLIDE
// ===========================================================================
function setSlide(slide) {
    
  autoPlay.restart(true);
  
  if (slide === currentSlide) {
    return;
  }
  
  currentSlide.setInactive();
  currentSlide = slide || currentSlide.next;
  currentSlide.setActive();
}

//
// CREATE SLIDE
// ===========================================================================
function createSlide(element, index) {
   
  var control = controlElements[index];
  var description = descriptionElements[index];
  
  // Public properties and methods for slide
  var slide = {   
    next: null, // will point to the next slide object
    duration: 0,
    index: index,
    element: element,
    control: control,
    description: description,
    isActive: false,
    setActive: setActive,
    setInactive: setInactive
  };
    
  if (index === 0) {
    setActive();
  } else {
    setInactive();
  }
  
  control.addEventListener("click", setSlide.bind(null, slide));
  
  function setActive() {
    slide.isActive = true;
    control.classList.add("active");
    TweenLite.fromTo(element, slide.duration, { xPercent: 100 }, { xPercent: 0 });
    TweenLite.fromTo(description, slide.duration, { xPercent: -100 }, { xPercent: 0 });
  }
  
  function setInactive() {
    slide.isActive = false;
    control.classList.remove("active");
    TweenLite.to(element, slide.duration, { xPercent: -100 });
    TweenLite.to(description, slide.duration, { xPercent: 100 });
  }
  
  return slide;
}
              
            
!
999px

Console