Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:52:25+00:00 2026-05-26T17:52:25+00:00

I building a simple (crude, in fact) gallery in html / twig, css and

  • 0

I building a simple (crude, in fact) gallery in html / twig, css and jquery. In the gallery I am trying to make a function that activates when the user hovers over an image. The function will fade-in a child div (that is hidden) and fade-out on when the user moves the cursor away from the div.

The problem I am running in to is that the function is not only affecting the child element, but also the parent (which I want to avoid).

jquery:

$(".gallery_image_wrapper").hover(function(){
    $(this).find(':last-child').fadeOut(100);
    $(this).find(':first-child').fadeIn(500);
});

html/twig (symfony)

<div class="gallery_image_wrapper">
      <div class="gallery_image">
          <a href="#">
              <img src="/web/images/pieceimages/{{ image.path }}" />
          </a>
      </div>
      <div class="gallery_mouseover">
          <div class="gallery_piece_info" align="center">
              <span class="gallery_info_title">
                  {{ image.pieceTitle }}
              </span>
              <br />
              <span class="gallery_info_artist">
                  {{ image.artistName }}
              </span>
              <br />
              <br />
              <span class="gallery_info_more">
                  Learn More
              </span>
          </div>
     </div>
</div>

css

.gallery_image_wrapper {
      float: left;
      position: relative;
      margin: 10px;
 }
 .gallery_mouseover {
      height: 100%;
      width: 100%;
      background-image: url({{ asset('/web/images/mouseover.png') }});
      position: absolute;
      top: 0px;
 }
 .gallery_piece_info {
      color: #ffffff;
      margin-left: auto;
      margin-right: auto;
      text-transform: uppercase;
      margin-top: 30%;
 }
 .gallery_info_title {
      font-size: 16pt;
      font-family: "Giacomo";
 }
 .gallery_info_artist {
      font-size: 12pt;
      font-family: "Giacomo Light";
 }
 .gallery_info_more {
      font-size: 9pt;
      font-family: "Giacomo Light";
 }

How would I accomplish this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:52:26+00:00Added an answer on May 26, 2026 at 5:52 pm

    I think you could use .children() for this:

    $(".gallery_image_wrapper").hover(function(){
        $(this).children(':last-child').fadeOut(100);
        $(this).children(':first-child').fadeIn(500);
    });
    

    Edit: After playing with this a bit in jsFiddle (ditching your CSS for the moment), I might suggest that you make this simpler by starting one child hidden and then using .toggle():

    $(".gallery_image_wrapper").hover(function(){
            $(this).children().toggle(100);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you are building a simple website using just simple HTML/CSS/Javascript that has say
I'm building a simple HTML/CSS template for myself, which is here , and it
I am building a simple website that needs 3 user levels (member, mod, admin)
I am building a simple Django app that will use scribd to display documents.
I'm building a simple accounting app to be used for personal finance. A user
I was building a simple web based calculator which takes equations from a HTML
I am building a simple book check out application. One of the things that
I building a simple class that is supposed to mimic the functionality of the
I'am building simple Ajax application (via jquery). I have strange issue. I found where
I building a simple search feature that checks against a column desc in mysql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.