【jQuery】How to implement a slider that divides the next slide image into 5 parts and displays them in order from the left(Demo page)

※Please check using Developer tools

Sponsored links

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
  });
});