CSS Randomizer
Stats at a glance
RANDOMIZATION USING CSS
Have you always wanted a random article button? Maybe a little bit of interactive flair to give your readers a chance to pull something from a hat/chest/shelf at random in your stories? Well then today's the day, here's a working randomizer that's actually fairly light-weight and easy to use :D There's a few limitations with it. One, this one only works by having 10 different options, each which must be filled out in the BBCode section. They don't all have to be unique, but they do all need content in them. Two, the different "choices" should each be the same relative size -- this is easily done with CSS, or you can just attempt to type the same amount in each one. Three -- sometimes it fails. But that's okay, there's a reset button to try again. Essentially, it works like a big slot machine wheel. It cycles all 10 options very quickly via animation (all while hidden away), and then when you click the button, it pauses the animation and brings the wheel container up, displaying whichever choice wound up on top. It's delightfully simple!Randomized Article Blocks
Randomized Container Blocks
This is Choice 1
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 2
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 3
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 4
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 5
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 6
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 7
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 8
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 9
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.This is Choice 10
And some filler text to go along with it. You likely want all of these random choices to be about the same length of content, so that they all cover eachother up. Or, you can do what I've done here, and add overflow scrolling to this container, and manually set the same height for each, so that they all line up perfectly.I've attempted to make the overall CSS design of this particular free add-on to fit to as many different themes as possible. I've also tried to make the CSS as clear as possible, so that it's easy for you other CSS wizards to go in and modify what you like or don't like about it! Adapt it to your own theme, go wild with it. All I ask is that credit is provided to me! A link back to this article is LOVELY, but if it doesn't fit, it's not required. Please check out the code below!
The Code
Note: There will be a small amount of fiddling needed to be done to match the randomizer to your theme. The select/reset text, the spoiler button width, or transparent backgrounds all may need to be changed. I've tried to put examples in the CSS so it's easy to see what needs to be modified.CSS
Note: You will need to remove the space between the / and the * on the comments in the CSS. The space needed to be added so that they'd show up on here. Or, just delete em.BBCODE
The BBcode is (super) simple. You've got two sections where you can input your "select" and "reset" text, if you want to modify it, and then 10 places where you can put article blocks, or other containers.In Article Use Examples
The Comprilith ('Venture Within' module)by Stormbril
This is awesome :O Would be a nice addition to some articles of my world :D
Thank you! :D I hope it proves useful and easy enough to implement!
Well, I done it. Now a little randomizer decorates my Homepage. Pretty neat if you asked me.
That is very exciting to hear :D