Random command
Randomly choose one or more elements from a selection of elements.
Basic Usage (HTML)
data-jkit="[random:count=5]"
Advanced Init (JavaScript)
$('#myelement').jKit('random', { 'count': '5' });
Options
Option | Values | Default | Description |
---|---|---|---|
count | Int | 1 | The number of elements to be selected/shown |
remove | “yes” or “no” | yes | Remove or just hide the elements? |
Events
Examples
Take two:
Randomly display two paragraph from a selection of three:
Text 1 (red)
Text 2 (green)
Text 3 (blue)
Source:
<div data-jkit="[random:count=2]"> <p id="rand1" style="color:#65BAE2"> Text 1 (red) </p> <p id="rand2" style="color:#C8295B"> Text 2 (green) </p> <p id="rand2" style="color:#BBD17C"> Text 3 (blue) </p> </div>
Random image:
In this example we are selecting one random image:
Source:
<div data-jkit="[random:count=1]"> <img src="../img/slides/p1.jpg" title="Image caption one"> <img src="../img/slides/p2.jpg" title="Image caption two"> <img src="../img/slides/p3.jpg" title="Image caption three"> <img src="../img/slides/p4.jpg" title="Image caption four"> <img src="../img/slides/p5.jpg" title="Image caption five"> </div>
Replacements
There are currently no replacements for this command.
[ Learn more about replacements ]
Discussions
Do you have questions or do you want to suggest new features? Than head over to our new community:
[ jKit Community ]