The obvious bug is start a>j then j>a at end. Ditto e>f>e
I confess logic is not my strength and I can't see what's wrong but, from an aesthetic point of view the mix just looks yuk.
If you want to play about here is my minified class sample:

@JMRKER
thanks for the long reply - especially considering my 'transgression' [grin]
I should have been more clear. The aim is to change colour on all color-divs on clicking another div

@holyhttp
>> then everything should be working just fine.
Yes, correct. I am sorry if I wasn't more clear. My last line above...
"The basic code works I am just trying for a bit more colour pizzazz mix. "

The question is one of logic - "I confess logic is not my strength..."

How to click one dixX and have the colour change in ALL color-divs - likely 50 to 100

Just to give you the scenario- using jquery Masonry Isotope. Building a language dictionary. The literal case here is toggling between English and x-language to give a colour change for all current word definition tiles.
We have:

@JMRKER
thanks for the long reply - especially considering my 'transgression' [grin]
I should have been more clear. The aim is to change colour on all color-divs on clicking another div
...

:confused:
So how are ALL colors to change?
Do the colors rotate in sequence? Forward or backward?
Are the new colors to be randomly assigned?

My guess was to swap the colors for the DIV selected with the opposite box in the delay sequence. What is/was your original intent?

08-27-2013, 07:50 PM

arfa

Thanks for persisting.

Not so much how the colours change - sequence, random, etc. - but that they go from one colour to a different colour. The change is purely a user indication of mode-shift; English>LangX>English. Just a visual cue. It doesn't even have to be a consistent change back and forth. For sure I've a more design brain than code cortex.

The 'problem' with my loop is that it just swaps, and makes no allowance for duplicates. The result is an unbalanced mix.

a goes to j
then, at end, (new) j goes back to a - plus original j goes to a
Ditto e>f>e

I have tried various array mixes but -clearly haven't found a happy balance. I imagine that there is some (simple?) way to be sure that each original color becomes an exclusively new color. As the word-tiles will be initially randomly assigned class (and then sorted, split by group, etc.) there is no way of totally insuring that two adjacent tiles aren't the same. C'est la vie.

Each of the following are questions about your logic needs...:confused:
1. When you click the first box color 'a' you want it to change to box color 'j'?
2. When you click the first box AGAIN, you want it to change back to box color 'a'?
3. What is to happen if you do #1 and then click the ('j'?) changed box? Does it change to 'a' or 'j'?

Randomly assigning the initial display, colorOld, is not a problem,
but it might effect the second array, colorNew,
if it too is a random match to the assignment from the colorOld array.
So are the arrays colorOld and colorNew linked when randomized or are they independent variables?

I can guess you needs all night, but it would be much faster if you would specify your design requirement.
Specifically set up a click sequence that would give you the changes you require so we can see what should happen
when you perform a pre-determined sequence of DIV box clicks.
What you have specified in your postings does not make sense to me, hence the repeated requests for clarification! :confused:

08-27-2013, 09:17 PM

arfa

Yes, an example could have saved 1000 words.colorToggle.html
Click 'English' and the tiles change - using my current swap routine: