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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:13:28+00:00 2026-06-18T16:13:28+00:00

here is my code: http://jsfiddle.net/FUnhK/ $(document).ready(function(){ $(img).hover(function(){ var text = $(this).attr(alt); $(h2).text(text); }); $(img).mouseout(function(){

  • 0

here is my code:
http://jsfiddle.net/FUnhK/

$(document).ready(function(){
    $("img").hover(function(){
        var text = $(this).attr("alt");
        $("h2").text(text);
    });
    $("img").mouseout(function(){
        $("h2").html("Basic Text");
    });

});

What I need is an animation for the hover() and mouseout() functions, so whenever I hover on one of the images, it shows the text and whenever the mouse leaves the image area it shows the “basic text” (as in the abovementioned code). It should look something like this:
http://jsfiddle.net/xgyaQ/
but as you can see I appended the animate({ opacity: ‘toggle’ }) function only for presentational purposes and it’s not functioning as it should.

I just need the functionality of the first code with the animate effect of the second and I have no idea how I should write the javascript to achieve that.

And one more thing – any idea what should i change so the basic text doesn’t show when hovering on the empty space between the images, because when you hover form one image to another it doesn’t look cool.

Thank you!

P.S.
Ok, thanks to Liquinaut I made it work with the fadeIn effect, but first hiding the element:

$(document).ready(function () {
    $("img").mouseenter(function () {
        var text = $(this).attr("alt");
        $("h2").text(text).hide().fadeIn(400);
    });
    $("ul").mouseleave(function() {
        $("h2").text('Basic Text').hide().fadeIn(400);
    });
});

http://jsfiddle.net/FUnhK/3

Thats the effect I was looking for. Is there a better way to achieve it?

  • 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-18T16:13:29+00:00Added an answer on June 18, 2026 at 4:13 pm

    This is probably what you need, based on your HTML/CSS:

    $(document).ready(function () {
        $("img").mouseenter(function () {
            var text = $(this).attr("alt");
            $("h2").text(text);
        });
        $("ul").mouseleave(function() {
            $("h2").text('Basic Text');
        });
    });
    

    Nonetheless you should think about rebuilding parts of your CSS, as floating list elements with absolute positioned image elements inside make no sense.

    cya,
    Liquinuat

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

Sidebar

Related Questions

See here for code: http://jsfiddle.net/ecFBK/10/ I'm having a hard time getting this to work
here is the code: http://jsfiddle.net/VW8V5/1/ When hover it should start looping but end of
here is the code: http://jsfiddle.net/hQnXm/7/ So basically i need when hover, it should animate
I'm using this plugin and here is the code: http://jsfiddle.net/gm8t5/ Basically I want to
I have this code here http://jsfiddle.net/RzBeM/65/ you will see two input fields called quantity.
here is the code : http://jsfiddle.net/yuliantoadi/hMr7h/ if you try to hover the 'test 2'
Here is sample code: http://jsfiddle.net/BSjGX/1/ <input id=testing /> $('#testing') .keydown(function(e){ if(e.keyCode==13) {return false;} })
I found this count down timer code here http://jsfiddle.net/QH6X8/ I would like to make
Please see working code here: http://jsfiddle.net/hrnDG/6/ I would like to modify this code so
I am fiddling with this javascript code here http://jsfiddle.net/7Sd4W/4/ I am trying to get

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.