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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <div class="wrap">
 <ul id="slide_wrap">
  <li class="slide_item">
    <img src="https://dl.dropbox.com/s/ou9633e762poylw/slide01.jpg?dl=0" alt="img1" onload="sliderStart()">
  </li>
  <li class="slide_item">
    <img src="https://dl.dropbox.com/s/fipy7gw576dw7fq/slide02.jpg?dl=0" alt="img2">
  </li>
  <li class="slide_item">
    <img src="https://dl.dropbox.com/s/k33q4jrkml3zl6j/slide03.jpg?dl=0" alt="img3">
  </li>
</ul>
</div>
              
            
!

CSS

              
                .wrap{
  padding: 16px;
}
#slide_wrap{
  position: relative;
  overflow: hidden;
  
  .slide_item{
    opacity: 0;
    transform: scale(1);
    transition: opacity 2s linear, transform 7.5s linear;  //transformはFadeTime + IntarvalTime + α秒
    position: relative;
    
    &:not(:first-child){
      position: absolute;
      top: 0;
      left : 0;
    }
  
    &.show_{
      opacity: 1;
    }
    &.zoom_{
      transform: scale(1.1);
    }
    img{
      display: block; //下に余白できないように
    }
  }
}


              
            
!

JS

              
                function sliderStart() {

    const slide = document.getElementById('slide_wrap');      //スライダー親
    const slideItem = slide.querySelectorAll('.slide_item');   //スライド要素
    const totalNum = slideItem.length - 1;                     // スライドの枚数を取得
    const FadeTime = 2000;                                     //フェードインの時間
    const IntarvalTime = 5000;                                 //クロスフェードさせるまでの間隔
    let actNum = 0;                                            //現在アクティブな番号
    let nowSlide;                                              //現在表示中のスライド
    let NextSlide;                                             //次に表示するスライド

    // DOM読み込み時にスライドの1枚目をフェードイン
    slideItem[0].classList.add('show_', 'zoom_');

    // 処理を繰り返す
    setInterval(() => {
        if (actNum < totalNum) {
          
            nowSlide = slideItem[actNum];
            NextSlide = slideItem[++actNum];

            //.show_削除でフェードアウト
            nowSlide.classList.remove('show_');
            // と同時に、次のスライドがズームしながらフェードインする
            NextSlide.classList.add('show_', 'zoom_');
            //フェードアウト完了後、.zoom_削除
            setTimeout(() => {
                nowSlide.classList.remove('zoom_');
            }, FadeTime);


        } else {

            nowSlide = slideItem[actNum];
            NextSlide = slideItem[actNum = 0];

            //.show_削除でフェードアウト
            nowSlide.classList.remove('show_');
            // と同時に、次のスライドがズームしながらフェードインする
            NextSlide.classList.add('show_', 'zoom_');
            //フェードアウト完了後、.zoom_削除
            setTimeout(() => {
                nowSlide.classList.remove('zoom_');
            }, FadeTime);

        };
    }, IntarvalTime);

}
              
            
!
999px

Console