A Pen by Lokesh Suthar

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

Technologies

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

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Lokesh Suthar</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <link href="https://fonts.googleapis.com/css?family=Patua+One|Work+Sans:400,700,800" rel="stylesheet">

<div class="mega-container">
  <div class="card-container card-1">
    <div class="card-desc">
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
        It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
        desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
    </div>
    <div class="card-image">
      <h1>Title 1</h1>
    </div>
  </div>
  <div class="card-container card-2">
    <div class="card-desc">
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
        It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
        desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
    </div>
    <div class="card-image">
      <h1>Title 2</h1>
    </div>
  </div>
  <div class="card-container card-3 current half-active full-active">
    <div class="card-desc">
      <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
        It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with
        desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
    </div>
    <div class="card-image">
      <h1>Title 3</h1>
    </div>
  </div>
</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/magnus16/a-pen-by-lokesh-suthar-womWyr */
body {
  background: -webkit-linear-gradient(to left, #BE93C5, #7BC6CC);
  background: linear-gradient(to left, #BE93C5, #7BC6CC);
  font-family: 'Work Sans', sans-serif !important;
}

h1,
h2,
h3,
h4 {
  font-family: 'Patua One', Helvetica, sans-serif !important;
  font-weight: normal;
}

.mega-container {
  position: absolute;
  overflow: hidden;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.card-container {
  height: 300px;
  width: 225px;
  position: absolute;
  cursor: pointer;
  transition: all 0.3s ease-in-out;
}

.card-desc,
.card-image {
  position: absolute;
  height: 100%;
  width: 100%;
  transition: all 0.3s ease-in-out;
}

.card-image {
  text-align: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  z-index: 1;
}

.card-image h1 {
  color: #fff;
  letter-spacing: 3px;
}

.card-desc {
  background: #fff;
}

.card-desc p {
  margin: 0;
  width: calc(100% - 30px);
  font-size: 11px;
  padding: 15px;
}

.card-1 .card-image {
  background-image: url('https://images.unsplash.com/photo-1414265247351-4afd13a3b4e6?dpr=1&auto=format&fit=crop&w=1500&h=1000&q=80&cs=tinysrgb');
}

.card-2 .card-image {
  background-image: url('https://images.unsplash.com/photo-1451153378752-16ef2b36ad05?dpr=1&auto=format&fit=crop&w=1500&h=1004&q=80&cs=tinysrgb');
}

.card-3 .card-image {
  background-image: url('https://images.unsplash.com/photo-1451191703739-5c2ad91bf6af?dpr=1&auto=format&fit=crop&w=1500&h=1126&q=80&cs=tinysrgb');
}

.card-1,
.card-2 {
  display: none;
}

.card-container.current {
  left: 50%;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
}

.card-container.half-active .card-image {
  transform: translateY(-20%);
}

.card-container.half-active .card-desc {
  transform: scale(1.20) translateY(20%);
}

.card-container.full-active {
  height: 100%;
  width: 100%;
}

.card-container.full-active .card-image {
  transform: translateY(0);
  height: 35%;
  top: 0;
}

.card-container.full-active .card-desc {
  transform: translateY(0);
  height: 65%;
  bottom: 0;
}

/*Downloaded from https://www.codeseek.co/magnus16/a-pen-by-lokesh-suthar-womWyr */
$('.card-container').on('click', function() {
  var $this = $(this);
  if ($this.hasClass('full-active')) {
    $this.removeClass('half-active');
    $this.removeClass('full-active');
  } else if ($this.hasClass('half-active')) {
    $this.addClass('full-active');
  } else{
    $this.addClass('half-active');
  }
});

Comments