Slide

In this example below you will see how to do a Slide with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by Dlabihcra, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright Dlabihcra ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Slide</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div class="hide"></div>
<div class="container">
  <img src="https://s-media-cache-ak0.pinimg.com/236x/4e/b8/02/4eb802b67b91dfbb9dfe605224dba64c.jpg" alt="owl" class="owl" />
  <img src="http://piq.codeus.net/static/media/userpics/piq_5608_400x400.png" alt="wolf" class="wolf" />
  <img src="https://s-media-cache-ak0.pinimg.com/564x/d9/ef/2c/d9ef2c336632d15472f44d2115627a10.jpg" alt="turtle" class="turtle" />
</div>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/Dlabihcra/slide-aBYKXK */
@import "https://codepen.io/Dlabihcra/pen/vmXBvg.css";
body {
  background-color: lightgrey;
}

.hide {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  right: 0;
  background-color: black;
}

.container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 100vh;
}
.container img {
  width: 175px;
  height: 175px;
  margin: 5px;
  mix-blend-mode: multiply;
}
.container .wolf {
  height: 250px;
  width: 250px;
  border: none;
}


/*Downloaded from https://www.codeseek.co/Dlabihcra/slide-aBYKXK */
slide();
function slide() {
  $('.hide')
    .animate({'width': 0}, 5000, () => {
    $('.hide')
      .css({'left': 0})
      .animate({'width': '100%'}, 5000, () => {
        console.log('hi')
        $('.hide')
          .css({'right': 0})
          [0].style.left = null;
        slide();
      })
  })
}

Comments