You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/syntax.rst
+29-5
Original file line number
Diff line number
Diff line change
@@ -168,22 +168,25 @@ These attributes are actions that will be executed when a ``pause`` or ``step``
168
168
Moves the screen untils the element is centered.
169
169
170
170
``focus`` or ``focus-at-unpause``
171
-
Focus on the element by zooming on it.
171
+
Focus on the element by zooming on it. Possible to specify multiple ids.
172
172
173
173
``unfocus`` or ``unfocus-at-unpause``
174
174
Unfocus by going back to the last position before a focus.
175
175
176
176
``static-at-unpause``
177
-
Make the element ``static``. By "static" we mean the css styling ``position:static; visibility:visible`` will be applied.
177
+
Make the element ``static``. By "static" we mean the css styling ``position:static; visibility:visible`` will be applied. Possible to specify multiple ids.
178
178
179
179
``unstatic-at-unpause``
180
-
Make the element ``unstatic``. By "unstatic" we mean the css styling ``position:absolute; visibility:hidden`` will be applied.
180
+
Make the element ``unstatic``. By "unstatic" we mean the css styling ``position:absolute; visibility:hidden`` will be applied. Possible to specify multiple ids.
181
181
182
182
``reveal-at-unpause``
183
-
Reveal the element. By "revealing" we mean the css styling ``opacity:1`` will be applied.
183
+
Reveal the element. By "revealing" we mean the css styling ``opacity:1`` will be applied. Possible to specify multiple ids.
184
+
185
+
``unreveal-at-unpause``
186
+
Hide the element. By "unrevealing" we mean the css styling ``opacity:0`` will be applied. Possible to specify multiple ids.
184
187
185
188
``exec-at-unpause``
186
-
Execute the slipscript.
189
+
Execute the slipscript. Possible to specify multiple ids.
187
190
188
191
Custom scripts
189
192
--------------
@@ -200,3 +203,24 @@ Use a slipscript code block to add a script, and ``exec-at-unpause`` to execute
Beware: experimental! Slip-scripts have access to a ``slip`` object, which they can use to programmatically call the functions above. Using such API registers an undo callback, and it is not needed to return an undo function.
207
+
208
+
.. code-block:: markdown
209
+
210
+
{exec-at-unpause}
211
+
```slip-script
212
+
let elem = document.querySelector("#id")
213
+
slip.up(elem);
214
+
```
215
+
216
+
Note that if a function above accepts multiple IDs (as ``unstatic-at-unpause`` for instance), then the function expects a list of elements:
217
+
218
+
.. code-block:: markdown
219
+
220
+
{exec-at-unpause}
221
+
```slip-script
222
+
let elems = document.querySelectorAll(".class")
223
+
slip.unstatic(elems);
224
+
```
225
+
226
+
In addition to the function above, you can use ``slip.setStyle(elem, style, value)`` where ``elem`` is an element, and ``style`` and ``value`` a string to set a style and register an undo callback. You can also use ``slip.setClass(elem, className, bool)`` where ``elem`` is an element, ``style`` is a string and ``bool`` a boolean to add or remove a class and register an undo callback.
0 commit comments