Hey Opally, thanks for sharing! And thanks for pointing out that issue with the line-height, I have been meaning to add that to that to the caption example in the documentation.
I haven’t done an animated caption exactly like that, but I have done one that slides in from the side, here’s something for the stylesheet that should get you pretty close:
.meteor-slides p {
background: rgba(0,0,0,0.2);
bottom: -40px;
color: #000;
height: 40px
left: 0;
line-height: 20px;
margin: 0;
padding: 2%;
position: absolute;
text-align: center;
width: 96%;
}
And this in a custom slideshow script:
before: function () {
$j('.meteor-slides p').css('bottom', -60);
$j('.meteor-slides p').animate({bottom:0}, 1500);
}
That would go at the end of the cycle options, just like the pagerAnchorBuilder option in the example.
Thread Starter
Opally
(@opally)
Thank you for the awesome fast reply!
You’ve give me a great start! It works as you say.
The issue I now see is that the caption starts sliding up as the next slide is sliding in. Ideally there would be a delay on the slideup, or rather, animate. You’d see the image for a second or two, and then the caption would slide up.
Do you happen to remember how to do a timed delay in jquery?
I’m not sure off the top of my head. When I used this on a project I had a bit of a delay on the captions, but what I did was put them -600px off the slideshow, so they start animating right when the slide transitions. but it doesn’t come on screen for a bit.
Thread Starter
Opally
(@opally)
hey, if you’ve set 10 seconds per slide in settings, this works pretty nice:
before: function () {
$j('.meteor-slides p').css('bottom', -60).delay(3000);
$j('.meteor-slides p').animate({bottom:0}, 1500).delay(5000);
$j('.meteor-slides p').animate({bottom:-60}, 1500);
}
Longer slide transitions will need this to be tweaked.
thank you for your help!!
No problem, I’ll have to try using animated captions more often!
Thread Starter
Opally
(@opally)
… and instead of adding more animation options to the slide interface, this would work for typical settings;
add these settings to the slideshow options in slideshow.js:
var $captiondelay = $slidespeed + 1000;
var $captionduration = $slidetimeout - ($slidespeed*2);
and change the animation function to use those variables for delays:
before: function () {
$j('.meteor-slides p').css('bottom', -60).delay($captiondelay);
$j('.meteor-slides p').animate({bottom:0}, 1500).delay($captionduration);
$j('.meteor-slides p').animate({bottom:-60}, 1500);
}
this way, you don’t have the fragility of hard-coding delays that might not work with someone’s option settings. Well, it’s still fragile, but only at the extremes.
Cool, I’ll give that a try.