Anything
A plugin for Reveal.js allowing to add anything inside an HTML object using a JSON string and a javascript function.
The plugin allows you to define a class for which the content of all HTML object of this class will be modified by a given javascript function.
Inside the HTML object you can provide a comment containing a JSON string that will be used by function to customise the content.
Setup
To use the plugin include
<!-- Anything plugin --> |
to the header of your presentation and configure reveal.js and the plugin by
Reveal.initialize({ |
Configuration
The plugin can be configured by providing an anything option containing an array of className, defaults, and f within the reveal.js initialization options.
Reveal.initialize({ |
With the above configuration the plugin searches for all HTML object with class random.
For each of the HTML objects it checks whether there is a JSON string within a comment inside the HTML object.
Then, it calls the function function(container, options) where container is the HTML object and options is the JSON string.
It is possible to specify the defaults parameter to be used if no JSON string is provided or not all values required by the function are given in the JSON string.
The code
<p> |
produces the output
<p> |
The code
<p> |
produces the output
<p> |
License
MIT licensed
Copyright © 2023 Asvin Goel