This project provides a simple web interface to view and interact with Cyango stories through an iframe. It includes a sidebar with scene navigation buttons and uses postMessage for communication between the parent page and the iframe.
-
Clone this repository to your local machine.
-
Open the
index.htmlfile in a text editor. -
Locate the
<iframe>tag and update thesrcattribute with your desired Cyango story URL. The URL should follow this format:<iframe id="storyIframe" src="https://www.cyango.com/story/YOUR_STORY_ID" frameborder="0" ></iframe>
Replace
YOUR_STORY_IDwith the actual ID of your Cyango story. -
Update the scene buttons in the
index.htmlfile to match your story's scenes:<button class="scene-button" data-scene="YOUR_SCENE_ID">Scene Name</button>
-
Replace the
logo.pngfile with your own logo image. -
Save the changes to
index.html. -
Open
index.htmlin a web browser to view your story.
- Sidebar with scene navigation buttons
- Collapsible sidebar for full-screen viewing
- Communication with the Cyango story iframe using postMessage
This project uses the postMessage API to communicate with the Cyango story iframe. The main action supported is:
GO_TO_SCENE: Change the current scene in the story
When a scene button is clicked, the parent page sends a message to the iframe with the following structure:
{ action: "GO_TO_SCENE", sceneId: "scene_id_here" }
The Cyango story iframe should be set up to listen for these messages and handle the scene changes accordingly.
You can customize the appearance of the sidebar and buttons by modifying the styles.css file. To add or remove scene buttons, edit the <div class="button-container"> section in the index.html file.
To change the color scheme, modify the following CSS properties in styles.css:
- Sidebar background:
.sidebarbackground-color - Button colors:
.scene-buttonbackground-color and color - Toggle button:
.toggle-btnbackground
To add more scene buttons, simply add more button elements to the button-container div in index.html:
If you encounter any issues with communication between the parent page and the iframe, ensure that:
- The iframe URL is correct and starts with
https://www.cyango.com/story/. - The Cyango story is set up to receive and handle postMessage events.
- There are no content security policies (CSP) blocking the communication.
This project should work in all modern browsers that support ES6 and the postMessage API, including:
- Google Chrome (latest version)
- Mozilla Firefox (latest version)
- Microsoft Edge (latest version)
- Safari (latest version)
This project is released under the MIT License. See the LICENSE file for details.
For any other issues or questions, please re