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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:51:11+00:00 2026-06-10T17:51:11+00:00

I am using a simple little jQuery script to rotate through some images. I’m

  • 0

I am using a simple little jQuery script to rotate through some images. I’m wondering if there is a way to grab the alt or title tag from an image and have that text appear below the image in a p or div tag.

Here is what I have so far:

jquery:

$(function(){
    $('.fadein img:gt(0)').hide();
    setInterval(function(){
      $('.fadein :first-child').fadeOut(1000)
         .next('img').fadeIn(1000)
         .end().appendTo('.fadein');}, 
     3500);
});

CSS

.fadein { position:relative; height:350px; }
.fadein img { position:absolute; left:0; top:0; }

HTML

<div class="fadein">
<img src="1.jpg" alt="This is Image One" />
<img src="1.jpg" alt="This is Image two" />
</div>
<p>CAPTION GOES HERE</p>

Any tips for integrating a changing caption into this that is fed by the alt tag?

Thanks!

  • 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-10T17:51:13+00:00Added an answer on June 10, 2026 at 5:51 pm

    Here’s one way to do it:

    $(function() {
        $('.fadein img:gt(0)').hide();
        $('.fadein').next().text($('img:first').get(0).alt);
        setInterval(function() {
            $('.fadein :first-child').fadeOut(1000, function() {
                $(this).closest('div').next().text('');
            }).next('img').fadeIn(1000, function() {
                $(this).closest('div').next().text(this.alt);
            }).end().appendTo('.fadein');
        }, 3500);
    });​
    

    JS Fiddle demo.

    Edited the answer to change the above to use caching of selectors, to minimise querying of the DOM:

    $(function() {
        var fadein = $('.fadein');
        fadein.find('img:gt(0)').hide();
        fadein.next().text(function() {
            return fadein.find('img:first').attr('alt');
        });
        setInterval(function() {
            fadein.find(':first-child').fadeOut(1000, function() {
                fadein.next().text('');
            }).next('img').fadeIn(1000, function() {
                fadein.next().text(this.alt);
            }).end().appendTo(fadein);
        }, 3500);
    });​
    

    JS Fiddle demo.

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

Sidebar

Related Questions

I need some simple calculations done using jquery. This example http://jsfiddle.net/tbL5r/ is pretty close.
I'm hosting a little site using a JavaScript to draw a simple graph. It
I'm using simple-html-dom to try and pull some code from another site. Here's some
I'm trying to put some simple jQuery code into the Wordpress header (usually just
I have a simple piece of jquery i am using to toggle the visibility
I'm looking for a simple & semantic way to code jQuery event handlers that
I'm having a little trouble using jQuery in Rails. I'd like to call the
I'm using jQuery Tablesorter plugin, it works fine. However there is a problem. Imagine
I have a problem using multiple (2) jQuery plugins. I've googled a little but
I'm trying to do a simple hover animation using jQuery, but I'm lost somewhere

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.