The way I have seen this trick done before is you put a copy of the
first slide at the end. Then when you get to the furthest right move,
you set the x back to 0. You do this without any transition time, and
nobody notices a thing.
So if you have slides:
[ 1 ] [ 2 ] [ 3 ] [ 4 ]
In your setup you would duplicate the first:
[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 1 ]
and mark it in some way for your animation function to notice. When
the transition from 4 -> 1 at the end is complete, at the last frame
you would set the left position of your inner ul back to 0. The next
animation moves the x by 250, so you start over by moving from 1 -> 2.
Walter
On Mar 24, 2010, at 11:47 AM, Ralph Brickley wrote:
Hello all!! I'm trying to create a carousel script and am stumbling.
Basically I have a div with overflow:hidden and a ul inside with my
sized slides.
When you click next or previous I do
$$('.slide').each ( function(e) {
new Effect.Move(e, { x:-250 } );
});
This is paraphrased a bit because I'm using my iPhone. However this
works fantastic but where I'm stck is putting the first slide at the
end so it comes back around in a circle!! I've tried pushing the
first item to the last, ie
$$('.slide').push( $$('.slide').shift() );
And then settin the first slides left; position to the en of the
line like;
$$(.slide).first().setStyle( { left: num_slides*slide_width+'px' } );
That works good the first slide movement but after the first
movement it is flawed and has a gap equal to a slides width and
everything is out of order after that.
Anyone feel like helping me learn this simple trick??
Sent from my iPhone
On Mar 24, 2010, at 7:08 AM, "T.J. Crowder" <t...@crowdersoftware.com>
wrote:
--
You received this message because you are subscribed to the Google
Groups "Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
.
To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com
.
For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en
.
--
You received this message because you are subscribed to the Google Groups "Prototype
& script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.