Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Show second child on image hover

$(document).ready(function() {
  var mousePos = {};

  $(window).mousemove(function(e) {
    mousePos.x = e.pageX;
    mousePos.y = e.pageY;
  });

  $(window).mouseleave(function(e) {
    mousePos.x = 0;
    mousePos.y = 0;
  });

  setInterval(function() {
    if (mousePos.x > 0 && mousePos.y > 0) {
      var color = "background: #000;";
      size = "height: 40px; width:40px;";
      var left = "left: " + (mousePos.x - 20) + "px;";
      var top = "top: " + (mousePos.y - 15) + "px;";
      var style = left + top + color + size;
      $("<div class='ball' style='" + style + "'></div>")
        .appendTo("#wrap")
        .one(
          "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
          function() {
            $(this).remove();
          }
        );
    }
  }, 5);
});
.bodies {
  display: flex;
}

.bodies * {
  position: absolute;
  height: 40vh;
}

html,
body {
  height: 100%;
  margin: 0;
  position: relative;
}

#wrap {
  width: 100%;
  height: 100%;
  position: relative;
}

.ball {
  pointer-events: none;
  position: absolute;
  border-radius: 50%;
  animation: implode 2s 0.4s ease-in-out;
  animation-fill-mode: both;
}

@keyframes implode {
  100% {
    transform: scale(0);
  }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="wrap">
  <div class="bodies">
    <img src="./Images/Blood.jpg" alt="" />
    <img src="./Images/Body.jpg" alt="" />
  </div>
</div>

This is my code for when I hover over the screen it creates div elements to display an animation type of effect with the circles. I just want to hide the image which is on the top of the second image when is hovered only over the specific area.

I just have this image on my mind where the green slide is the image below and the yellow one above and the green hole is the part hovered which shows the below imageenter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

CSS background on #wrap and .bodies place a :hover pseudo-class on .bodies.

$(document).ready(function() {
  var mousePos = {};

  $(window).mousemove(function(e) {
    mousePos.x = e.pageX;
    mousePos.y = e.pageY;
  });

  $(window).mouseleave(function(e) {
    mousePos.x = 0;
    mousePos.y = 0;
  });

  setInterval(function() {
    if (mousePos.x > 0 && mousePos.y > 0) {
      var color = "background: rgb(138, 3, 3);";
      size = "height: 40px; width:40px;";
      var left = "left: " + (mousePos.x - 20) + "px;";
      var top = "top: " + (mousePos.y - 15) + "px;";
      var style = left + top + color + size;
      $("<div class='ball' style='" + style + "'></div>")
        .appendTo("#wrap")
        .one(
          "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",
          function() {
            $(this).remove();
          }
        );
    }
  }, 5);
});
.bodies {
  display: flex;
}

.bodies * {
  position: absolute;
  height: 40vh;
}

html,
body {
  height: 100%;
  margin: 0;
  position: relative;
}

#wrap {
  width: 100%;
  height: 100%;
  position: relative;
  background-image: url(https://cdn.picpng.com/blood/blood-picture-39852.png);
  background-color: black;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;  
}

.bodies {
  position:absolute;
  top: 25%;
  left: 25%;
  width: 50%;
  min-height: 50%;
  border-radius: 50%;
  background-color: transparent;
  background-image: url(https://longreadsblog.files.wordpress.com/2018/07/laura-palmer.jpg );
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
}

.bodies:hover {
  transition: all 0.5s;
  opacity: 0;
}

.ball {
  pointer-events: none;
  position: absolute;
  border-radius: 50%;
  animation: implode 2s 0.4s ease-in-out;
  animation-fill-mode: both;
}

@keyframes implode {
  100% {
    transform: scale(0);
  }
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="wrap">
  <div class="bodies">

  </div>
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!