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

              
                <body>
  <div class="content">
    <ul id="slider">
      <li><img src="https://spica-weblog.github.io/codepen-lesson/img/sample_img (1).jpg" alt=""></li>
      <li><img src="https://spica-weblog.github.io/codepen-lesson/img/sample_img (2).jpg" alt=""></li>
      <li><img src="https://spica-weblog.github.io/codepen-lesson/img/sample_img (3).jpg" alt=""></li>
      <li><img src="https://spica-weblog.github.io/codepen-lesson/img/sample_img (4).jpg" alt=""></li>
      <li><img src="https://spica-weblog.github.io/codepen-lesson/img/sample_img (5).jpg" alt=""></li>
      <li><img src="https://spica-weblog.github.io/codepen-lesson/img/sample_img (6).jpg" alt=""></li>
    </ul>
  </div>
</body>
              
            
!

CSS

              
                img {
  max-width: 100%;
}
ul {
  list-style: none;
}
#slider {
  width: 100%;
  margin: 0 auto;
  position: relative;
}

/* [共通]スライダー矢印 */
#slider .prev,
#slider .next {
  width: 40px;
  height: 40px;
  background-color: #000;
  cursor: pointer;
  opacity: 0.7;
  position: absolute;
  top: 45%;
  transition: 0.6s;
  z-index: 100;
}
#slider .prev:hover,
#slider .next:hover {
  opacity: 0.5;
}
#slider .prev::before,
#slider .prev::after,
#slider .next::before,
#slider .next::after {
  content: "";
  display: block;
  width: 14px;
  height: 2px;
  background-color: #fff;
  position: absolute;
}

/* [左]スライダー矢印 */
#slider .prev {
  left: 20;
}
#slider .prev::before,
#slider .prev::after {
  left: 12px;
}
#slider .prev:before {
  top: 37%;
  transform: rotate(-45deg);
}
#slider .prev:after {
  bottom: 37%;
  transform: rotate(45deg);
}

/* [右]スライダー矢印 */
#slider .next {
  right: 0;
}
#slider .next::before,
#slider .next::after {
  right: 12px;
}
#slider .next:before {
  top: 37%;
  transform: rotate(45deg);
}
#slider .next:after {
  bottom: 37%;
  transform: rotate(-45deg);
}

/* レスポンシブ */
@media screen and (max-width: 900px) {
  #slider .prev,
  #slider .next {
    top: 40%;
  }
}
              
            
!

JS

              
                $(document).ready(function(){
  $('#slider').slick({
    autoplay: true,                         // 自動再生オン
    autoplaySpeed: 5000,                    // スライドを5秒で切り替え
    arrows: true,                           // 左右の矢印を表示
    dots: true,                             // ドット(ページ送り)を表示
    slidesToShow: 1,                        // スライドを1枚表示
    centerMode: true,                       // 両端が見切れて表示される
    centerPadding: '18%',                   // 見切れたコンテンツの幅の設定
    prevArrow:'<div class="prev"></div>',   // 左矢印のHTMLを変更する
    nextArrow:'<div class="next"></div>',   // 右矢印のHTMLを変更する
    responsive: [              // レスポンシブの設定
      {
        breakpoint: 900,       // 900px以下の場合に適用
        settings: {
          centerMode: false    // センターモードをオフにする
        }
      }
    ]
  });
});


              
            
!
999px

Console