K
K
ktotitakoy2021-07-03 20:48:09
css
ktotitakoy, 2021-07-03 20:48:09

Why does the mavic_image element go down on hover?

Take a look at the mavic element and mavic_image which is responsible for the photo which should move up on hover and should be held until the cursor is removed from the mavic
HTML block:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="css/style.css">
    <meta name="viewport" content="width=device-width">
</head>
<body>
    <div class="wrapper">
        <div class="mavic">
            <div class="mavic__image">
                <img src="img/mavic.png" alt="">
            </div>
            <div class="mavic__title">
                Mavic
            </div>
        </div>
    </div>
</body>
</html>


CSS:
.mavic {
  width: 600px;
  height: 400px;
  background-color: #8bbe6d;
  margin: 0 auto;
  cursor: pointer;
  position: relative;
  overflow: hidden; }
  .mavic__image {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-animation-name: mavic-on;
    animation-name: mavic-on;
    animation-duration: 1s;
    animation-fill-mode: forwards;
    animation-timing-function: ease-out; }
@keyframes mavic-on {
  0% {
    transform: translateY(-200%); }
  60% {
    transform: translateY(30px); }
  70% {
    transform: translateY(-20px); }
  80% {
    transform: translateY(15px); }
  90% {
    transform: translateY(-5px); }
  100% {
    transform: translateY(0); } }
    .mavic__image:hover {
      animation-name: mavic-off;
      animation-duration: 1s;
      animation-timing-function: ease-out;
      animation-fill-mode: forwards; }
.mavic__image:hover {
      animation-name: mavic-off;
      animation-duration: 1s;
      animation-timing-function: ease-out;
      animation-fill-mode: forwards; }

@keyframes mavic-off {
  0% {
    transform: translateY(0); }
  100% {
    transform: translateY(-200%); } }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question