![]() |
Best way to "slide" an array?
Okay so.. I'm trying to display a list of categories, I have these said categories listed in an array. Basically what I want from this is display 3 of the 6 categories in a vertical line, than as I press the left or right key, I would like to cycle through these categories. I have done this.. but it isn't the desired effect that I want. I want these categories to "slide" left and right when you scroll through them.. Basically say I have, "Test 1", "Test 2", "Test 3" and "Test 4", 1 through 3 are displayed, 2 being the selected category, I than press the left key, Test 2 would slide to where Test 1 is display, Test 3 sliding to where Test 2 is, and than Test 4 coming in from the side going to where Test 3 was, so on and so forth. Anyone mind giving me some tips on what would be the best way to do this.. ? I can't think of any way to do it.. :confused:
|
When sliding down (everything's shifted up), find the farthest category on the bottom's (that's visible) position in the array. Slide everything up (hide the top-most visible), and get the next category. If you're at the end of the array, just get the first entry. Opposite applies for sliding up (shifted down).
|
I usually just keep track of the index of the currently selected item (the one in the middle), and then increase or decrease that index whenever the user "slides" the list right or left and mod by the size of the array.
For example, PHP Code:
|
That works and all.. but it's not exactly what I meant by slide.. I already have done what you're doing, but when I say slide, I mean I want the variables to actually have a visible slide.. meaning they MOVE from point a to point b. If you know what I mean? :confused:
|
Quote:
they do not have a position they also do not have an appearance so you could not even see them move if they did what are you even talking about |
Maybe you should use showimg or showtext or whatever the hell and come up with a reasonable way to calculate coordinates!
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 10:57 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.