Plugin Parameter
Parameters for plugins are defined as data attributes on the same element as the plugin itself. Parameters has to start with the plugin name followed by the parameter name: data-<plugin-name>-<parameter-name>
In HTML markup, words are separated by a hyphen and noted in lowercase. When parsing, the parameter names are converted into camelcase notation.
<div data-plugins="p1, p2WithMultipleWords"
data-p1-key="p1 value"
data-p1-some-property="property value"
data-p2-with-multiple-words-key="p2 value">
<! -- ... -->
</div>
The markup above will be parsed into the following parameters, that will be passed to the plugin factory.
Plugin | Parameter |
---|---|
p1 |
{ key: "p1 value", someProperty: "property value" } |
p2WithMultipleWords |
{ key: "p2 value" } |