@@ -2,21 +2,25 @@ Relative Positioning Plugin
2
2
===========================
3
3
4
4
This plugin provides support for defining the coordinates of a step relative
5
- to the previous step . This is often more convenient when creating presentations,
5
+ to previous steps . This is often more convenient when creating presentations,
6
6
since as you add, remove or move steps, you may not need to edit the positions
7
7
as much as is the case with the absolute coordinates supported by impress.js
8
8
core.
9
9
10
10
Example:
11
11
12
- <!-- Position step 1000 px to the right and 500 px up from the previous step. -->
13
- <div class="step" data-rel-x="1000" data-rel-y="500">
12
+ <!-- Position step 1000 px to the right and 500 px up from the previous step. -->
13
+ <div class="step" data-rel-x="1000" data-rel-y="500">
14
+
15
+ <!-- Position step 1000 px to the left and 750 px up from the step with id "title". -->
16
+ <div class="step" data-rel-x="-1000" data-rel-y="750" data-rel-to="title">
14
17
15
18
Following html attributes are supported for step elements:
16
19
17
20
data-rel-x
18
21
data-rel-y
19
22
data-rel-z
23
+ data-rel-to
20
24
21
25
Non-zero values are also inherited from the previous step. This makes it easy to
22
26
create a boring presentation where each slide shifts for example 1000px down
@@ -32,7 +36,16 @@ a unit of "h" and "w", respectively, appended to the number.
32
36
33
37
Example:
34
38
35
- <div class="step" data-rel-x="1.5w" data-rel-y="1.5h">
39
+ <div class="step" data-rel-x="1.5w" data-rel-y="1.5h">
40
+
41
+ Note that referencing a special step with the ` data-rel-to ` attribute is * limited to previous steps* to avoid the possibility of circular or offending positioning.
42
+ If you need a reference to a step that is shown later make use of the goto plugin:
43
+
44
+
45
+ <div id="shown-first" class="step" data-goto-next="shown-earlier">
46
+ <div id="shown-later" class="step" data-goto-prev="shown-earlier" data-goto-next="shown-last">
47
+ <div id="shown-earlier" class="step" data-rel-to="shown-later" data-rel-x="1000" data-rel-y="500" data-goto-prev="shown-first" data-goto-next="shown-later">
48
+ <div id="shown-last" class="step" data-goto-prev="shown-later">
36
49
37
50
38
51
IMPORTANT: Incompatible change
@@ -47,15 +60,15 @@ will inherit the value from the previous step. (The first step will inherit the
47
60
For example, if you have an old presentation with the following 3 steps, they would be positioned
48
61
differently when using a version of impress.js that includes this plugin:
49
62
50
- <div class="step" data-x="100" data-y="100" data-z="100"></div>
51
- <div class="step" data-x="100" data-y="100"></div>
52
- <div class="step" data-x="100" data-y="100"></div>
63
+ <div class="step" data-x="100" data-y="100" data-z="100"></div>
64
+ <div class="step" data-x="100" data-y="100"></div>
65
+ <div class="step" data-x="100" data-y="100"></div>
53
66
54
67
To get the same rendering now, you need to add an explicit ` data-z="0" ` to the second step:
55
68
56
- <div class="step" data-x="100" data-y="100" data-z="100"></div>
57
- <div class="step" data-x="100" data-y="100" data-z="0"></div>
58
- <div class="step" data-x="100" data-y="100"></div>
69
+ <div class="step" data-x="100" data-y="100" data-z="100"></div>
70
+ <div class="step" data-x="100" data-y="100" data-z="0"></div>
71
+ <div class="step" data-x="100" data-y="100"></div>
59
72
60
73
Note that the latter code will render correctly also in old versions of impress.js.
61
74
0 commit comments