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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:29:26+00:00 2026-05-30T05:29:26+00:00

I’ve created a slideshow using jquery cycle, and each of the slide divs contain

  • 0

I’ve created a slideshow using jquery cycle, and each of the slide divs contain child divs that contain images and text, and was wondering if it’s possible to animate the text in one of the child divs after each slide is displayed using ‘onAfter’. Basically I was wondering if it’s possible to animate anything within a slideshow div once the slide is complete. I can’t seem to get anything to happen or to be animated once a slide is displayed.

//Run the slide show:
$('#slide').cycle({ 
    fx:     'fade', 
    timeout: 1000, 
    after: onAfter,
});

//function to animate element within the '#slide' div after slide is rotated in
function onAfter() { 
   $('#slide div .right').animate({
   easing: 'linear',
   //shrink the font size down
   fontSize : '18px',
}, 2000, function() {
   // Animation complete.
});
};

Here’s the html:

    <div id="slide">
    <div><!--slide 1-->
    <div class="left"><img src="images/theimage1.jpg" alt="An Image" /></div>
    <div class="right">this is the text I want to animate once the slide is shown</div>
    </div>

    <div><!--slide 2-->
    <div class="left"><img src="images/theimage2.jpg" alt="An Image" /></div>
    <div class="right">animate more text once this slide is displayed</div>
    </div>

    <div><!--slide 3-->
    <div class="left"><img src="images/theimage3.jpg" alt="An Image" /></div>
    <div class="right">animate this text when slide 3 is shown</div>
    </div>

    </div><!--end #slide -->

here’s the css:

    <style type="text/css" media="all">
    #slide { width: 950px; border: none; background-color: #fff;  }
    #slide div { width: 100%; }
    #slide div .left    {float: left; width: 350px; padding: 0;}
    #slide div .right   {float: right; color: #666; font-size: 40px; width: 560px; }
    </style>
  • 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-30T05:29:27+00:00Added an answer on May 30, 2026 at 5:29 am

    I found a solution that works, albeit it’s probably not the optimal solution.

    It looks like the code you provided was pretty much all you needed. As is, it worked for me for the first slide but not subsequent slides. The reason is that the onAfter function selects all “.right” divs to animate. Consequently, the first time it’s run all the “.right” divs are in their final state, so running it again has no effect (you’re telling each one to animate from 18px to 18px). The key, then, is to reset the text to it’s original size so it can be shrunk, but only for the upcoming slide.

    To do this, you can use the plugin’s “before” and “after” callbacks each send several parameters, which include “currSlideElement” and “nextSlideElement” as the first two parameters (you can see how I incorporate these in the code below). First a quick side note, though: The “after” callback seems to instead receive the previous element and the current element, rather than the current and next as the plugin’s documentation states. I’m not sure if this is a bug in the plugin or a typo in the documentation, or perhaps (more likely), I’m just misunderstanding something. Either way, we can get it to work…

    So the only changes are as follows:
    I added a before callback to the slideshow:

    $('#slide').cycle({ 
        fx:     'fade', 
        timeout: 5000,
        before: onBefore,
        after: onAfter
    });
    

    And here are the callbacks:

    function onBefore(currentElement, nextElement) {
        $(nextElement).find('.right').css({fontSize: '40px'}); // reset css for upcoming text
    }
    
    function onAfter(previousElement, currentElement) {
        // Note: Plugin documentation says parameters should be (currentElement, nextElement), but that doesn't seem to be the case! 
        $(currentElement).find('.right').animate({fontSize: '18px'}, 2000); // animate current text
    };
    

    Hope that helps (and excuse me if I over-explained… hopefully it will help other readers if anything).

    Cheers.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

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.