This is the main method of JClic
Executes on document.ready()
.
The method iterates over all div
objects with JClic
class and creates a JClicPlayer
within them. Each player loads the JClic project file specified in the data-project
attribute of
the div
tag.
The div
elements must preferabily be empty. Inner content may become overlapped by objects
created by the JClic player.
This method exports the global variable window.JClicObject
, useful when other scripts
need to make direct calls to the main components of JClic.
The main members of the global variable JClicObject
are:
JClicObject.JClicPlayer
(themodule:JClicPlayer
object)JClicObject.JClicProject
(themodule:JClicProject
object)JClicObject.AWT
(themodule:AWT
object)JClicObject.Utils
(themodule:Utils
object)JClicObject.$
(the JQuery object)JClicObject.options
(the main options loaded at startup, usually the content of the global variableJClicDataOptions
)JClicObject.projectFiles
(used by JSONP to store the content of some files when inaccessible to the browser because CORS or other restrictions)JClicObject.currentPlayers
(array with references to the players currently running)JClicObject.loadProject
(a function that starts a JClicPlayer on a specificdiv
)
Examples
<caption>
Creates a JClic div and loads "myproject.jclic" on it:
</caption><div class ="JClic" data-project="myproject.jclic"></div>
<caption>
Creates a JClic div that loads "myproject.jclic" with additional parameters, passed as a JSON string.
Note that `data-options` should be delimited by apostrophes `'` because quotation marks `"` are used
for JSON keys and values:
</caption><div class ="JClic" data-project="myproject.jclic" data-options='{"fade":"400","lang":"es","reporter":"TCPReporter","user":"test01","path":"localhost:9090"}'></div>
Methods
(static) loadProject(div, projectName, optionsopt) → {module:JClicPlayer.JClicPlayer}
Creates a new JClicPlayer hosted on the specified div
, and loads an specific project on it.
Name | Type | Attributes | Description |
---|---|---|---|
div | external:HTMLElement | The HTML element (usually a | |
projectName | string | The file name or URL of the JClic project to be loaded | |
options | object | <optional> | An optional set of preferences |