-
-
Notifications
You must be signed in to change notification settings - Fork 1
How to use data magic tags in HTML snippets
Max Ziebell edited this page Oct 5, 2020
·
2 revisions
If you don't know how to set data with Hype Data Magic please read and follow the getting started guide. For this example, we will be using data-magic-key
inside the innerHTML. First set the data in your Hrad HTML to the following for this example to work:
HypeDataMagic.setData({
name: 'Max Ziebell',
button: 'Start over',
});
Then copy & paste the following into an rectangle on stage using the pencil tool after double-clicking it:
"<span data-magic-key="button">button</span>" is the phrased used in this demo from <span data-magic-key="name">name</span> to advance to the next scene.
Hype Data Magic works based on using a query to search for attributes containing the magic dataset keys. Hence, you can also use them inside the innerHTML
of an rectangle (actually a DIV).
- Double clicking a rectangle containing a
data-magic-key
shows the keys instead of the actuall preview. - If you want to edit the underlying inner HTML just click the pencil icon
- This will open the actual inner HTML and you can use
data-magic-key
and the other Hype Data Magic specific dataset value in there - Note how the Additional HTML Attributes doesn't require any keys in such a setup
- Choose another topic from the sidebar
- Return to the welcome page
- Consider making an one-time donation
Beginner guides
- How to use data magic branches
- How to use data magic sources
- How to use data magic tags in HTML snippets
Intermediate Guides
Advanced Topics