【jQuery】次のスライド画像を5分割に分けて左から順番に表示させるスライダー(slick)の実装方法のデモページ

※デベロッパーツール等でソースコードをご確認ください(Please check using Developer tools)

マイナビAGENT

スポンサーリンク

マイナビAGENT

CSS

.block {
  position: relative;
  width: 700px;
  line-height: 0;
  margin: 70px auto 0;
}

.list li {
  position: relative;
}

.split {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 0;
}

.split span {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 25%;
  height: 100%;
  overflow: hidden;
  opacity: 1;
}
.split span:nth-child(2) {
  left: 25%;
  z-index: 3;
}
.split span:nth-child(3) {
  left: 50%;
  z-index: 4;
}
.split span:nth-child(4) {
  left: 75%;
  z-index: 5;
}
.split span img {
  position: absolute;
  left:0;
  width: auto;
  height: 100%;
}
.split span:nth-child(2) img {
  left: -100%;
}
.split span:nth-child(3) img {
  left: -200%;
}
.split span:nth-child(4) img {
  left: -300%;
}

.img {
  opacity: 0;
  transition: all 0.5s ease-out 0.5s;
}

.slick-active .split {
  opacity: 1;
}

.slick-active .split span { opacity: 0;}
.slick-active .split span:first-child {
  transition: all 0.8s ease-out 0.3s;
}
.slick-active .split span:nth-child(2) {
  transition: all 0.8s ease-out 0.55s;
}
.slick-active .split span:nth-child(3) {
  transition: all 0.8s ease-out 0.8s;
}
.slick-active .split span:nth-child(4) {
  transition: all 0.8s ease-out 1.05s;
}

.slick-active .img {
  opacity: 1;
}

@media screen and (max-width:640px){
  .block {
    width: 100%;
  }
}

JavaScript

$(function() {
  $('.list').slick({
    autoplay: true,
    autoplaySpeed: 3000,
    arrows: false,
    dots: true,
    pauseOnFocus: false,
    pauseOnHover: false,
    fade: true
  });
});