[jQuery] cycle plugin: problem dynamically changing timeout
Hi all,
i'm planning to use the cycle plugin for a slideshow on a new site,
and i was implementing the only feature it miss out of the box: a
different timeout for each slide.
This is what i have done: using the Metadata plugin i added a timeout
property on each image, read it within a 'before' function, and
changed timeout accordingly. What's happen is that it looks like slide
does not have a timeout ( instead of having animation in -> wait ->
animation out i have animation in -> animation out).
What i found really strange, is that if i put an alert displaying the
current value and type for opts.timeout before and after the change, i
get che right values: 'number' type, 4000 before the first slide, the
the value previously set.
I'm doing something stupid somewhere ? (i'm new to jQuery and not so
much proficient with javascript)
Start and onBefore function:
<script type="text/javascript">
$(function() {
$('.pics').cycle({before:onBefore, continuous:1, fit:1});
});
function onBefore(curr, next, opts)
{
var meta = $(curr).metadata();
opts.timeout = meta.timeout;
}
</script>
The slide definition:
<div class="pics">
<img id="img1" class="slimage {timeout:3000,}" src="img/
ss19.jpg" alt="ss19.jpg">
<img id="img2" class="slimage {timeout:5000,}" src="img/ss24.jpg"
alt="ss24.jpg" >
<img id="img3" class="slimage {timeout:8000,}" src="img/ss30.jpg"
alt="ss30.jpg">
<img id="img4" class="slimage {timeout:6000,}" src="img/ss57.jpg"
alt="ss57.jpg">
<img id="img5" class="slimage {timeout:4000,}" src="img/ss61.jpg"
alt="ss61.jpg">
</div>