Each slide is composed of a box for the title and an image.
<div id="slideshowWindow">
<div id="One" class="slide">
<div class="slideTitle">
<h2>First title</h2>
</div>
<img src="/image.jpg" />
</div>
<div id="Two" class="slide">
<div class="slideTitle">
<h2>Second title</h2>
</div>
<img src="/image2.jpg" />
</div>
</div>
I'm trying to add a secondary animation within each slide so that the title box starts to slide away from the image and at the same time the whole slide moves away (with Cycle defaults animations). The effect wanted is visible in ibm website homepage (http://www.ibm.com). I'm trying to use Cycle's callbacks 'after' and 'before':
$(document).ready(function() {
$('#slideshowWindow').cycle({
fx: 'scrollHorz',
timeout: 5000,
after: onAfter,
before: onBefore
});
});
function onAfter(cycle) {
$(".slideTitle").delay(200).animate({marginLeft:"10px"}, 200 );
};
function onBefore(cycle) {
$(".slideTitle").animate({marginLeft:"-400px"}, 100 );
};
But this way the second slide's title is already visible when the first slide is sliding away, because callbacks are applied on both titles. So I can't figure out how to make the first go away and the second come in (or just stay still) in parallel.