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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:33:35+00:00 2026-05-23T05:33:35+00:00

I have 2 images on my page. when I hover over img.a, it changes

  • 0

I have 2 images on my page. when I hover over img.a, it changes opacity to 0 and works perfectly. However I would like img.c to also change opacity to 0 when img.a is being hovered over. My code works for img.a but nothing for img.c

<script type='text/javascript'>
$(document).ready(function(){
$("img.a").hover(
function() {
$(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
$(this).stop().animate({"opacity": "1"}, "slow");
},
function() {
$("img.c").stop().animate({"opacity": "0"}, "slow");
},
function() {
$("img.c").stop().animate({"opacity": "1"}, "slow");
});

});
</script>
  • 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-23T05:33:36+00:00Added an answer on May 23, 2026 at 5:33 am

    The problem is your syntax.

    jQuery’s hover() function only has two arguments – the two functions. The first one is the one which is called when you mouseover the element, and the other one is called when you mouse out.

    You’re almost there, now all you need to do is combine the 4 functions into two functions and it will work:

    <script type='text/javascript'>
    $(document).ready(function(){
    
      $("img.a").hover(
    
        function() { // this function is called on mouseover img.a
            $(this).stop().animate({"opacity": "0"}, "slow");
            $("img.c").stop().animate({"opacity": "0"}, "slow");
        },
        function() { // this function is called on mouseout img.a
            $(this).stop().animate({"opacity": "1"}, "slow");
            $("img.c").stop().animate({"opacity": "1"}, "slow");
        }
    
      });
    
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an image map in my page: <div id=books> <img src=images/books.png width=330 height=298
I have four images on a page that on hover, needs to replace the
I have a hover solution setup with CSS. However, the hover images don't respect
I have a series of photos on a page, and when you hover over
I have a page listing the images. And when I hover on that image
I have an image on my page and when the user hovers over it
a I have some images on page and I want to put <span> tag
I have 5 images on my page. These images are layered on each other
I have a simple page with images, and when the user clicks the image,
I have a page where I am loading bunch of images initially when the

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.