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 6319097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:44:42+00:00 2026-05-24T15:44:42+00:00

The Following is my code but I am having the problem again where I

  • 0

The Following is my code but I am having the problem again where I have more then one button on the site and when you hover over the class contentAddToCart then they all pop up. How do I make it so just the one you hover over actives the display.

Jquery

$('.contentAddToCart').hover(function(){
        $('.contentPosterBackgroundIcon').show(); },
        function(){ $('.contentPosterBackgroundIcon').hide();
    });

HTML

<div class="contentPosterBackgroundIcon sprite"></div>
<a class="contentAddToCart" href="">Buy Now<span></span></a>

CSS

.sprite {
    background: url('sprite.png');
}

.contentPosterBackgroundIcon {
    position: absolute;
     background-position: -87px -104px;
     display:block;
     height:25px;
     width:7px;
     top: 22px;
     left: 88px;
     display: none;
}

I thought if I did the following it would fix this but maybe I am not understanding something:

$('.contentAddToCart').hover(function(){
        $('.contentPosterBackgroundIcon', this).show(); },
        function(){ $('.contentPosterBackgroundIcon', this).hide();
    });
  • 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-24T15:44:42+00:00Added an answer on May 24, 2026 at 3:44 pm
    $('.contentAddToCart').hover(function(){
        $('.contentPosterBackgroundIcon', this).show(); },
        function(){ $('.contentPosterBackgroundIcon', this).hide();
    });
    

    The above won’t work as it’s looking for $(‘.contentPosterBackgroundIcon’) as a child of $(‘.contentAddToCart’).

    Try this:

    $('.contentAddToCart').hover(function(){
        $(this).prev('.contentPosterBackgroundIcon').show(); },
        function(){ $(this).prev('.contentPosterBackgroundIcon').hide();
    });
    

    It’s looking for a matched element that is a previous sibling.

    Also, you don’t need to have “display” in your CSS twice. display:none is all you need. Using .show() will change it to display:block

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings again, I have this problem again on C but now using struct. Having
I have the following code but the lon/lat seems to be returning null; package
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I have come across the following jQuery code but could not understand it. What
I'm having a little problem with the css display property. I have the following
I am having the following problem. I have the numbers 1/2/3/4/5/6 and I want
I'm new to programming and having a problem with the following code: private string
I'm having a problem with the following code - function slideContactDetails() { if (sliderState
I'm having a problem with my jQuery code on http://alpha.spherecat1.com/ , but the local
I wrote following code...but i am getting Error like: Error 1 'LoginDLL.Class1.Login(string, string, string)':

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.