Skip to content

The iframe controller for interacting with SpringRoll applications

Notifications You must be signed in to change notification settings

jcreed-csky/SpringRollContainer

 
 

Repository files navigation

SpringRoll Container

The <iframe> controller for interacting with SpringRoll applications either by SpringRoll Connect or accessing locally. The Container works both in the context of a Cordova-based application or on a webserver.

Installation

Install with Bower.

bower install springroll-container

Install with NPM.

npm install springroll-container

Usage

Basic usage for opening a SpringRoll application via a local path. This can be used to open a game with a relative or absolute (e.g. "http://...") path.

<iframe id="game" scrolling="no"></iframe>
<script>
    var container = new springroll.Container("#game");
    container.openPath("game.html");
</script>

Custom Interface Elements

The Container supports custom interface elements for managing things like toggle captions and sound. Here's an example of creating a button to toggle the sound within the game.

<button id="soundButton">Mute</button>
<iframe id="game" scrolling="no"></iframe>
<script>
	var container = new springroll.Container("#game", {
	    soundButton: "#soundButton"
	});
	container.openPath('game.html');
</script>
Option Description
helpButton Triggers in-game help
captionsButton Toggles the display of captions
soundButton Toggles all audio mute
voButton Toggles only voice-over mute
sfxButton Toggles only sound effects mute
musicButton Toggles only music mute
pauseButton Plays and pause the game

##Documentation

API Documentation has full documentation for the Container.

##License

Copyright (c) 2015 CloudKid

Released under the MIT License.

About

The iframe controller for interacting with SpringRoll applications

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.6%
  • HTML 1.4%