matthewlein / jQuery-jSlots

jQuery slot machine insanity! Turns any list into a slot machine (you provide the insanity)
184 stars 95 forks source link

How to set different values for each slot (one list for each slot)? #10

Closed matuskopo closed 7 years ago

matuskopo commented 10 years ago

Hi,

It's not an issue, but question, if it's possible, to do this, or if it needs changes to code.

Thank you. Great job

matthewlein commented 10 years ago

Hello,

Some other people have asked that same thing on http://matthewlein.com/experiments/slots.html

I can imagine 2 scenarios that might want to do this, and I'm not sure which applies to you:

It should be possible, but a little outside the planned design. I would suggest after the .jSlots() is run, you loop through the slots and add unique classes, like jslot--1, slot--2, or slot--even slot--odd. Or alternatively, you could use CSS :n-th child to target different slots. I should warn you that if your classes change the dimensions of slot items, it may not work right as those values have been calculated already.

The script by default will just copy a single UL to make the slots. I suppose it might be possible to create multiple ULs and .jSlot() them separately, but with the same timing numbers, and set them all to trigger on the same event. I haven't tried it, but in my mind that would work. However, then you would have to set up your own system to make them talk to each other and coordinate wins, like the script does now. Certainly seems doable though.