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>