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

158
Views
How to select an element that already has an on hover state with jquery?

I want to add css styles with jquery to an element when another element is hover, the problem is this other element has a css hover effect already, how can i target this already hovered element with jquery? Is a gallery of images that has an overlay color on hover, what i want to do is to add an opacity effect to a h3 tag when the gallery image is hover. This is the link: estudiodecimal.com/proyectos/ Here is some code i tried

$(".et_pb_gallery_image img").on('hover', function() {
        $("h3.et_pb_gallery_title").css("opacity", 1);
    });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You are not targeting the h3 correctly. Since both the H3 and the img share a common parent, you can find the h3 through closest() and find(), like this. I added in a fadeIn and fadeOut rather than a show/hide.

$(".et_pb_gallery_image img").hover(imgHover, imgHover)

function imgHover(e) {
  let o = $(this).closest('.et_pb_gallery_item').find("h3");
  if (e.type == 'mouseenter') o.fadeIn();
  else o.fadeOut()
}
h3 {
  display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class='et_pb_gallery_item'>
  <div class='et_pb_gallery_image'>
    <img src='https://picsum.photos/200/300' />
  </div>
  <h3>Title</h3>
</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!