> -----Original Message-----
> From: Dan Vega [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 13, 2007 11:21 AM
> Subject: Re: Best Solution
>
> I know I can use Prototype to show/hide different divs which
> would work out great. Is there a way to toggle using a Timer.
// Set it up like this:
// var shuffle_list1 = ['div1', 'div2', 'div3']; // an array of DIV
IDs to rotate
// var shuffle_time = 8000; // 8 seconds
// var shuffle_effect = 'blind'; // the effect to us: 'appear',
'blind' or 'slide'
// setTimeout('imageShuffle(shuffle_list1);', shuffle_time); //
start the show
// Note:
// * The first DIV to be viewed should be visible, the rest should have
// style="display:none;" added to the HTML attributes - do not add this
to
// a separate CSS file or it won't work
function imageShuffle() {
shuffle_list = arguments[0];
if(arguments.length == 2) {
var i = arguments[1];
} else {
var i = 0;
}
var next = i + 1;
if(next >= shuffle_list.length)
next = 0;
new Effect.toggle(shuffle_list[i], shuffle_effect, {queue:
'end'});
new Effect.toggle(shuffle_list[next], shuffle_effect, {queue:
'end'});
i++;
if(i >= shuffle_list.length)
i = 0;
setTimeout('imageShuffle(shuffle_list, '+i+');', shuffle_time);
}
The above code is hereby released into the public domain. We deny all
responsibility for you making your website look bad, for your spouse
leaving you for a goat, or the world imploding.
One tip, btw, put all of the DIVs that cycle inside another DIV that has
fixed dimensions, it'll work around a bug in Safari 2 (from OSX Tiger)
and generally helps to keep things better organized. For example:
<div id="rotate">
<div id="rotate_1"><img src="img1.png" /</div>
<div id="rotate_2"><img src="img1.png" /</div>
<div id="rotate_3"><img src="img1.png" /</div>
</div>
<script type="Javascript" language="Javascript1.2">
var shuffle_list1 = ['rotate_1', 'rotate_2', 'rotate_3'];
var shuffle_time = 5000; // 5 seconds
var shuffle_effect = 'blind';
setTimeout('imageShuffle(shuffle_list1);', shuffle_time);
</script>
Damien McKenna
Web Developer
The LIMU Company
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7.
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:281037
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4