【CSS】How to implement convenient crossfade by switching before and after images/Crossfade Between Two Images with CSS Animations | Demo page

※Please check using Developer tools

Sponsored links

CSS

.block {
  width: 768px;
  margin: 50px auto 0;
}
.block ul {
  position: relative;
  padding: 60% 0 0;
}

.block li {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.block .l-02{
  opacity: 0;
}

.block.active .l-02 {
  opacity: 1;
  transition: opacity 1.5s cubic-bezier(.40, .580, .570, 1) 1.5s;
}

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

JavaScript

$(window).on('load', function(){
  $(".block").addClass("active");
});