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

  • SEARCH
  • Home
  • 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 8396711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:36:35+00:00 2026-06-09T20:36:35+00:00

I have the following HTML added to various DIV’s cross my application. It’s an

  • 0

I have the following HTML added to various DIV’s cross my application. It’s an overlay that I want to show on only the DIV that’s hovered. However, if I hover over any element with the HTML block of code below, as the overlays will show on all the DIVs. But I only want the overlay to show on the DIV i hover, not all of them. I was attempting to find the .parent(), but it’s not working. What am i doing wrong?

<div id="appBillboard">
    <!-- edit window overlay -->
    <div class="editOverlay">
        <div class="editBTN">
            <div class="editIcon bL5"></div>
            <div class="editTxt bR5 bRLight">EDIT</div>
        </div>
    </div>
</div>

JS:

//HOVER HIDE & SHOW EDIT OVERLAY AND BUTTON

var editBTN = $('.editBTN');
var overlay = $('.editOverlay');

$(editBTN).fadeTo(0, 0.90);

$(overlay).hover(function () {

    //find parent div
    var location = $(this).parent();

    $(overlay, location).fadeTo(0, 1);
    $(editBTN, location).fadeTo(0, 1);
    $(overlay, location).addClass('overlayBKGND');

}, function () {
    $(overlay).removeClass('overlayBKGND');
    $(editBTN).fadeTo(0, 0.90);

});
  • 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-06-09T20:36:37+00:00Added an answer on June 9, 2026 at 8:36 pm

    You need to use selectors that are scoped only to the hierarchy that you are in. As such, you can’t use your cached jQuery objects as they include all objects.

    In addition, you have to recalculate the location variable in each of the two functions passed to .hover() as they are separate functions and don’t share local variables.

    I also don’t know why you’re using fadeTo() with a 0 for the duration of the animation. It’s probably better to just use .css("opacity", value) rather than go through the whole animation code.

    Change your code to this:

    $(overlay).hover(function () {
        //find parent div
        var location = $(this).parent().parent();
        $('.editOverlay', location).fadeTo(0, 1).addClass('overlayBKGND');
        $('.editBTN', location).fadeTo(0, 1);
    
    }, function () {
        var location = $(this).parent().parent();
        $('.editOverlay', location).removeClass('overlayBKGND');
        $('.editBTN', location).fadeTo(0, 0.90);
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so i have the following html added to a site using javascript/greasemonkey. (just
I have following HTML: <div class=olympics style=display: block; position: absolute; left: 250px; top: px;>
I have the following html : <div class=mainmenu> <ul class=blue> <li class=><a href=tst/ id=a1_up><span
I have the following HTML <div class=myclass value=1> <div> <div class=myclass value=> <a class=popup
I have the following JavaScript that creates a div and then appends it to
I have the following html tag <input type=text id=txtColor /> <div id=wrapper> <div id=someDynamicElement></div>
I have the following HTML snippet: <body> <div class=main> <div class=topBar> <p>testing</p> </div> <div
I have the following html: <div id=cats-and-links> <div class=cat favorites> <h2>Favorites</h2> <ul class=ui-sortable> <li
Have the following html code: <div id=container> <div id=container2> ... </div> </div> and the
I have the following HTML code: <div id=summary_form> <textarea class=summary>Please fill in</textarea><br/> <textarea class=summary>Please

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.