Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <!-- .container -->
<div class="container">

  <!-- .gallery-slider -->
  <div class="gallery-slider">

    <!-- __images -->
    <div class="gallery-slider__images">
      <div>
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/700/450" alt="Kitten 1"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/450/700" alt="Kitten 2"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/770/450" alt=""></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/200/210" alt="Kitten 4"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/300/310" alt="Kitten 5"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/770/200" alt="Kitten 6"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/200/770" alt="Kitten 7"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/545/321" alt="Kitten 8"></div>
        </div>
        <!-- /.item -->
      </div>
      <button class="prev-arrow slick-arrow">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1792">
          <path fill="#fff" d="M1171 301L640 832l531 531q19 19 19 45t-19 45l-166 166q-19 19-45 19t-45-19L173 877q-19-19-19-45t19-45L915 45q19-19 45-19t45 19l166 166q19 19 19 45t-19 45z" />
        </svg>
      </button>
      <button class="next-arrow slick-arrow">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1792">
          <path fill="#fff" d="M1107 877l-742 742q-19 19-45 19t-45-19l-166-166q-19-19-19-45t19-45l531-531-531-531q-19-19-19-45t19-45L275 45q19-19 45-19t45 19l742 742q19 19 19 45t-19 45z" />
        </svg>
      </button>
      <span class="caption">&nbsp;</span>
    </div>
    <!-- /__images -->


    <!-- __thumbnails -->
    <div class="gallery-slider__thumbnails">
      <div>
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/700/450" alt="Kitten 1"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/450/700" alt="Kitten 2"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/770/450" alt=""></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/200/210" alt="Kitten 4"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/300/310" alt="Kitten 5"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/770/200" alt="Kitten 6"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/200/770" alt="Kitten 7"></div>
        </div>
        <!-- /.item -->
        <!-- .item -->
        <div class="item">
          <div class="img-fill"><img src="https://placekitten.com/545/321" alt="Kitten 8"></div>
        </div>
        <!-- /.item -->
      </div>

      <button class="prev-arrow slick-arrow">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1792">
          <path fill="#fff" d="M1171 301L640 832l531 531q19 19 19 45t-19 45l-166 166q-19 19-45 19t-45-19L173 877q-19-19-19-45t19-45L915 45q19-19 45-19t45 19l166 166q19 19 19 45t-19 45z" />
        </svg>
      </button>
      <button class="next-arrow slick-arrow">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 1792">
          <path fill="#fff" d="M1107 877l-742 742q-19 19-45 19t-45-19l-166-166q-19-19-19-45t19-45l531-531-531-531q-19-19-19-45t19-45L275 45q19-19 45-19t45 19l742 742q19 19 19 45t-19 45z" />
        </svg>
      </button>
    </div>
    <!-- /__thumbnails -->

  </div>
  <!-- /.gallery-slider -->

</div>
<!-- /.container -->
              
            
!

CSS

              
                $light-grey: #e6e6e6;

* {
  box-sizing: border-box;
}
body {
  font-family: Helevetica, Arial, sans-serif;
}

.container {
  max-width: 770px;
}

.gallery-slider {
	position: relative;
	overflow: hidden;
  background-color: $light-grey;

	// __images
	&__images {
		margin: 0;
		position: relative;
		.item {
			padding: 0;
			.img-fill {
				text-align: center;
				padding: 10px;
				height: 200px;
				@media screen and (min-width: 576px) {
					height: 300px;
				}
				@media screen and (min-width: 720px) {
					height: 450px;
				}

				img {
					display: inline-block;
					position: relative;
					max-width: 100%;
					max-height: 100%;
					top: 50%;
					transform: translateY(-50%);
				}
			}
		}
		.next-arrow, .prev-arrow {
			position: absolute;
			top: 50%;
			transform: translateY(-50%);
			width: 47px;
			height: 47px;
			border-radius: 50%;
			background: rgba(0, 0, 0, .70);
			border: 0 none;
			text-align: center;
			color: #FFF;
			z-index: 5;
			opacity: 0;
			transition: all 0.5s;
			outline: 0;
			svg {
				top: 4px;
			}
		}
		.next-arrow {
			right: 25px;
		}
		.prev-arrow {
			left: 25px;
		}
		&:hover .next-arrow, &:hover .prev-arrow {
			opacity: 1;
		}
    .caption {
			width: 100%;
			position: relative;
			text-align: center;
			display: block;
			opacity: 1;
			transition: opacity 0.15s;
			&.hide {
				opacity: 0;
			}
		}
	}

	// __thumbnails
	&__thumbnails {
		position: relative;
		top: auto;
		left: 0px;
		width: 100%;
		z-index: 4;
		transition: all 0.8s;
		margin: 0;
		padding: 13px 0;
		&:before, &:after {
			content: '';
			display: block;
			width: 100px;
			height: 100%;
			position: absolute;
			top: 0;
			z-index: 10;
			pointer-events: none;
		}
		&:before {
			left: 0;
			background: linear-gradient(to right, rgba($light-grey,1) 0%,rgba($light-grey,0) 100%);
		}
		&:after {
			right: 0;
			background: linear-gradient(to right, rgba($light-grey,0) 0%,rgba($light-grey,1) 100%);
		}
		.item {
			.img-fill {
				height: 70px;
				background: white;
				cursor:pointer;
				border: 5px solid white;
				text-align: center;
				img {
					opacity: 0.5;
					transition: all 0.5s;

					display: inline-block;
					position: relative;
					max-width: 100%;
					max-height: 100%;
					top: 50%;
					transform: translateY(-50%);
					
				}
			}
			&:hover .img-fill img {
				opacity: 1;
			}
			&.slick-center {
				img {
					opacity: 1;
				}
			}
		}
		.next-arrow, .prev-arrow {
			position: absolute;
			width: 40px;
			height: 40px;
			top: 50%;
			transform: translateY(-50%);
			background: rgba(0, 0, 0, .60);
			color: #FFF;
			border: 0 none;
			z-index: 15;
			svg {
				top: 2px;
			}
		}
		.next-arrow {
			right: 0px;
		}
		.prev-arrow {
			left: 0px;
		}
	}

	// generic arrows
	.next-arrow, .prev-arrow {
    cursor: pointer;
		svg {
			width: 18px;
			height: 18px;
			position: relative;
		}
	}

	// image fills
	.img-fill {
		width: 100%;
		display: block;
		overflow: hidden;
		position: relative;
		text-align: center
	}

	// slick overrides
	.slick-slider {
		margin: 0 -7.5px;
		padding: 0!important;
	}
	.slick-slide {
		float: left;
		padding: 0 7.5px;
    outline: none;
	}

}
              
            
!

JS

              
                	/*
		variables
	*/

		var $imagesSlider = $(".gallery-slider .gallery-slider__images>div"),
			  $thumbnailsSlider = $(".gallery-slider__thumbnails>div");

	/*
		sliders
	*/

		// images options
		$imagesSlider.slick({
			speed:300,
			slidesToShow:1,
			slidesToScroll:1,
			cssEase:'linear',
			fade:true,
			draggable:false,
			asNavFor:".gallery-slider__thumbnails>div",
			prevArrow:'.gallery-slider__images .prev-arrow',
			nextArrow:'.gallery-slider__images .next-arrow'
		});

		// thumbnails options
		$thumbnailsSlider.slick({
			speed:300,
			slidesToShow:5,
			slidesToScroll:1,
			cssEase:'linear',
			centerMode:true,
			draggable:false,
			focusOnSelect:true,
			asNavFor:".gallery-slider .gallery-slider__images>div",
			prevArrow:'.gallery-slider__thumbnails .prev-arrow',
			nextArrow:'.gallery-slider__thumbnails .next-arrow',
			responsive: [
				{
					breakpoint: 720,
					settings: {
						slidesToShow: 4,
						slidesToScroll: 4
					}
				},
				{
					breakpoint: 576,
					settings: {
						slidesToShow: 3,
						slidesToScroll: 3
					}
				},
				{
					breakpoint: 350,
					settings: {
						slidesToShow: 2,
						slidesToScroll: 2
					}
				}
			]
		});

	/* 
		captions
	*/

		var $caption = $('.gallery-slider .caption');

		// get the initial caption text
		var captionText = $('.gallery-slider__images .slick-current img').attr('alt');
		updateCaption(captionText);

		// hide the caption before the image is changed
		$imagesSlider.on('beforeChange', function(event, slick, currentSlide, nextSlide){
			$caption.addClass('hide');
		});

		// update the caption after the image is changed
		$imagesSlider.on('afterChange', function(event, slick, currentSlide, nextSlide){
			captionText = $('.gallery-slider__images .slick-current img').attr('alt');
			updateCaption(captionText);
		});

		function updateCaption(text) {
			// if empty, add a no breaking space
			if (text === '') {
				text = '&nbsp;';
			}
			$caption.html(text);
			$caption.removeClass('hide');
		}
              
            
!
999px

Console