-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.html
110 lines (104 loc) · 4.39 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<p><h1>Sequential activation: activate elements one after the other</h1></p>
<p>Sometimes you need to automatically set elements active, one after the other, e.g. for creating running lights.</p>
<p>See it in action: <a href="http://rayhyde.github.io/sequential_activation/">http://rayhyde.github.io/sequential_activation/</a></p>
<h2>The Goodies</h2>
<p>You can activate the plugin on as many elements on the page as you need, bar the processing limits of your viewer's computer, of course.</p>
<p>You can set the speed and how many times you want it to loop till indefinite.</p>
<p>If you only want the activation sequence to run once, you can opt to keep everything active.</p><br>
<h2>How to use this plugin</h2>
<h3>1. Link the files you need</h3>
<p>Include the jQuery script at the bottom of your page, e.g. through a CDN:</p>
<p><code> <script src="//code.jquery.com/jquery-2.1.3.min.js"></script></code></p>
<p>Then include the minimized version of the script:</p>
<p><code><script src="[path to your script]/jquery.sequential_activation.min.js"></script></code></p>
<p>Change [path to your script] to where it resides, eg "js".</p>
<h3>2. Create your HTML markup</h3>
<p>This is very simple: create an element and style the element containing it. Like</p>
<pre><ul id="lights">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<style>
#lights {
margin: 0;
padding: 0;
list-style: none;
background: black;
}
#lights li {
width: 10px;
height: 10px;
border-radius: 50%;
...
}
</style>
</pre>
<h3>3. Call the plugin</h3>
<p>Then initialize the plugin, telling it in which element it needs to run:</p>
<pre>
<script>
$(<containing element here, e.g. "#lights">).sequentialActivation({
animationSpeed: 1000,
elementToActivate: 'li',
loop: 0,
keepActive: false
});
// a second container:
$(<containing element here, e.g. "nav">).sequentialActivation({
animationSpeed: 1000,
elementToActivate: 'div',
loop: 3,
keepActive: false
});
</script>
</pre>
<h3>4. Putting it all together</h3>
<p>This is your basic page to get the plugin up and running:</p>
<pre><!DOCTYPE html>
<html>
<head>
...
<link rel="stylesheet" href="css/mysequential_activation.css">
</head>
<body>
...
<ul id="lights">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
...
<script src="//code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="js/jquery.sequential_activation.min.js"></script>
<script>
$('#lights').sequentialActivation();<br> </script>
</body>
</html>
</pre>
<h2>Options</h2>
<p>If you don't specify options, like in the example above, the plugin will use its default settings: <br>
- animation speed: 300 <br>
- the element that needs to be activated: 'li' <br>
- loop: 0, thus indefinite <br>
- keep active: false. In the example of running
</p>
<p>These are the options:</p>
<h3>Speed</h3>
<p>in the usual thousands of seconds</p>
<code>animationSpeed: 300</code>
<h3>Elements that need to be activated</h3>
<p>This lists the elements in the container that will be activated one by one:</p>
<code>elementToActivate: 'li'</code>
<h3>Loop</h3>
<p>You can specify the number of times it needs to loop. '0' means indefinite</p>
<code>loop: 0</code>
<h3>Keep active</h3>
<p>The elements will remain activated if set to 'true'. This means that looping needs to be set to '1', as otherwise the script continues unnecessarily.</p>
<p><code>keepActive: false</code></p>
<p><a href="downloads/sequential_activation.zip" class="btn btn-primary btn-lg download">Download from Github</a></p>
<h2>My Playground</h2>
<p>This project is part of my Playground - a collection of fun (and dare I say it: clever) stuff I made in the past, from jQuery games and plugins to CSS animation tricks.</p>
<p>Please drop in on my portfolio site <a href="http://www.rayhyde.nl">www.rayhyde.nl</a>!</p>