Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I achieve a zoom out to another image transition effect

Tags:

html

css

I'm looking to transition images with zoom out to the 2nd image, 3rd image, so on. I tried making it myself with some keyframes via background-image and scale, and it worked decently except there were 2 issues. 1. My text and buttons were also scaled, 2. the duration of the images was too short. I would include it but I have deleted it since it was not what I was looking for. Not sure if there's a way this would be doable with pure CSS, at least not easily. So I'm leaning towards I'm going to have to use JS? Here is my current code.

.jumbo {
  display: flex;
  flex-direction: column;
  justify-content: Center;
  margin: 0;
  width: 100vw;
  height: 100vh;
  min-height:100vh;
  background: linear-gradient(rgba(255, 255, 255, 0.1), rgba(0, 0, 0, 0.3)),
    url("images/j-img1.png");
  background-repeat:no-repeat;
  background-position: center center;
  -webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
.jumbo-text {
  text-align: center;
  color: white;
  font-weight: 600;
}

/* Jumbo button */
.vmore-button {
  text-align: center;
  border: 2px solid white;
  text-transform: uppercase;
  padding: 16px;
  align-self: Center;
  margin: 20px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 24px;
  transition: 0.5s ease;
  color: white;
  max-height: 70px;
  cursor:pointer;
}
    <div class="jumbo">
      <h2 class="jumbo-text">
        Welcome to LLG
      </h2>
      <h3 class="jumbo-text animated slideInLeft delay-1s" style="color:#e8e8e8; font-weight:500;">
        Memorable Gaming Experience, High Quality Servers.
      </h3>
      <a class="vmore-button hvr-icon-pulse-shrink" href="#viewmore">View more<br><i class="fas fa-arrow-circle-down hvr-icon"></i></a>
    </div>
like image 902
Tim Avatar asked Jan 18 '20 06:01

Tim


Video Answer


1 Answers

You'll need a container div, and two child dividers. The first child should handle images zooming/transitioning, the second child should contain your text. Both the images and text dividers should be positioned absolute so they are on top of each other. You can change which span/image are active/visible by applying a specific class to the parent container.

<div class="container">
  <div class="images">
    <img>
    <img>
    <img>
  </div>
  <div class="text">
    <span>TextA</span>
    <span>TextB</span>
    <span>TextC</span>
  </div>
</div>
like image 107
Tom Shaw Avatar answered Sep 28 '22 01:09

Tom Shaw