|
-
Sep 5th, 2001, 10:52 AM
#1
Thread Starter
Evil Genius
-
Sep 5th, 2001, 11:10 AM
#2
Frenzied Member
They don't get added if they are adjacent because...
Lets say you have five items, A, B, C, D, and E. A is the first item, so it has an index of 0. Let's say you have selected B, C and E.
It cycles through starting with index 0.
A is not selected.
Next index. Index 1.
B is selected.
Add B to the right.
Remove B from the Left
Next Index. Index 2. Keep in mind that the left is now A, C, D, and E. So index 2 is the third item, that is now D, not C.
D is not selected.
Next index. Index 3.
E is selected.
Add E to the right.
Remove E from the Left
Next Index. Index 4. Index 4 exceeds the length, return from loop.
If you want to immediately remove the item from the left, then subtract 1 from your index (index--), so when it adds one again, it will pick up the next one in the sequence (which has been shortened).
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
-
Sep 5th, 2001, 11:25 AM
#3
Thread Starter
Evil Genius
You've been doing this a little while haven't you ;D
YABADABADOO !!!!
Thanks for that (think I'll keep that source handy for ajother time) - makes sense now you explained it, but I'd have never spotted that in a million years. Thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|